From a4ca5f812d17d1e924cbd3c5483c2058dcc9f35c Mon Sep 17 00:00:00 2001 From: dexy Date: Thu, 27 Dec 2018 21:37:44 +1100 Subject: [PATCH] Dat151 progress --- .../GameFiles/FileTypes/RelFile.cs | 376 +++++++--- CodeWalker.Core/GameFiles/GameFileCache.cs | 2 +- .../EditAudioEmitterListPanel.Designer.cs | 87 +++ Project/Panels/EditAudioEmitterListPanel.cs | 107 +++ .../Panels/EditAudioEmitterPanel.Designer.cs | 704 ++++++++++++++++++ Project/Panels/EditAudioEmitterPanel.cs | 576 +++++++++++++- Project/Panels/EditAudioFilePanel.Designer.cs | 117 +++ Project/Panels/EditAudioFilePanel.cs | 65 ++ .../Panels/EditAudioZoneListPanel.Designer.cs | 34 +- Project/Panels/EditAudioZoneListPanel.cs | 27 + Project/Panels/EditAudioZonePanel.Designer.cs | 66 +- Project/Panels/EditAudioZonePanel.cs | 1 + Project/Panels/ProjectExplorerPanel.cs | 121 ++- Project/ProjectForm.cs | 172 ++++- 14 files changed, 2264 insertions(+), 191 deletions(-) diff --git a/CodeWalker.Core/GameFiles/FileTypes/RelFile.cs b/CodeWalker.Core/GameFiles/FileTypes/RelFile.cs index 9ac398c..1b867c3 100644 --- a/CodeWalker.Core/GameFiles/FileTypes/RelFile.cs +++ b/CodeWalker.Core/GameFiles/FileTypes/RelFile.cs @@ -58,7 +58,7 @@ namespace CodeWalker.GameFiles Dat54DataEntries = 54, Dat149 = 149, Dat150 = 150, - Dat151Parameters = 151 + Dat151 = 151 } [TC(typeof(EXP))] public class RelFile : GameFile, PackedFile @@ -417,7 +417,7 @@ namespace CodeWalker.GameFiles return ReadData149(d, dbr); case RelDatFileType.Dat150: //game.dat150.rel return ReadData150(d, dbr); - case RelDatFileType.Dat151Parameters: //game.dat151.rel + case RelDatFileType.Dat151: //game.dat151.rel return ReadData151(d, dbr); default: return d; //shouldn't get here... @@ -673,7 +673,7 @@ namespace CodeWalker.GameFiles { case RelDatFileType.Dat149: case RelDatFileType.Dat150: - case RelDatFileType.Dat151Parameters: + case RelDatFileType.Dat151: break; case RelDatFileType.Dat4://TODO! case RelDatFileType.Dat54DataEntries://TODO! @@ -753,7 +753,7 @@ namespace CodeWalker.GameFiles { case RelDatFileType.Dat149: case RelDatFileType.Dat150: - case RelDatFileType.Dat151Parameters: + case RelDatFileType.Dat151: break; case RelDatFileType.Dat4://TODO! case RelDatFileType.Dat54DataEntries://TODO! @@ -806,7 +806,7 @@ namespace CodeWalker.GameFiles { case RelDatFileType.Dat149: case RelDatFileType.Dat150: - case RelDatFileType.Dat151Parameters: + case RelDatFileType.Dat151: break; case RelDatFileType.Dat4://TODO! case RelDatFileType.Dat54DataEntries://TODO! @@ -854,8 +854,8 @@ namespace CodeWalker.GameFiles { case RelDatFileType.Dat149: case RelDatFileType.Dat150://treat these same as 151 - case RelDatFileType.Dat151Parameters: - relType = RelDatFileType.Dat151Parameters; + case RelDatFileType.Dat151: + relType = RelDatFileType.Dat151; break; case RelDatFileType.Dat54DataEntries: break; @@ -948,7 +948,7 @@ namespace CodeWalker.GameFiles return fcstr + ((Dat54SoundType)ItemType).ToString(); case RelDatFileType.Dat149: case RelDatFileType.Dat150: - case RelDatFileType.Dat151Parameters: + case RelDatFileType.Dat151: return fcstr + ((Dat151RelType)ItemType).ToString(); } @@ -1107,8 +1107,8 @@ namespace CodeWalker.GameFiles var newRelDatas = new List(); var newRelDatasSorted = new List(); - newRelDatas.AddRange(RelDatas); - newRelDatasSorted.AddRange(RelDatasSorted); + if (RelDatas != null) newRelDatas.AddRange(RelDatas); + if (RelDatasSorted != null) newRelDatasSorted.AddRange(RelDatasSorted); newRelDatas.Add(d); newRelDatasSorted.Add(d); @@ -1122,18 +1122,24 @@ namespace CodeWalker.GameFiles var newRelDatas = new List(); var newRelDatasSorted = new List(); - foreach (var relData in RelDatas) + if (RelDatas != null) { - if (relData != d) + foreach (var relData in RelDatas) { - newRelDatas.Add(relData); + if (relData != d) + { + newRelDatas.Add(relData); + } } } - foreach (var relData in RelDatasSorted) + if (RelDatasSorted != null) { - if (relData != d) + foreach (var relData in RelDatasSorted) { - newRelDatasSorted.Add(relData); + if (relData != d) + { + newRelDatasSorted.Add(relData); + } } } @@ -2615,6 +2621,11 @@ namespace CodeWalker.GameFiles public uint EmitterCount { get; set; } public MetaHash[] EmitterHashes { get; set; } + public Dat151AmbientEmitterList(RelFile rel) : base(rel) + { + Type = Dat151RelType.AmbientEmitterList; + TypeID = (byte)Type; + } public Dat151AmbientEmitterList(RelData d, BinaryReader br) : base(d, br) { EmitterCount = br.ReadUInt32(); @@ -2878,31 +2889,31 @@ namespace CodeWalker.GameFiles } [TC(typeof(EXP))] public class Dat151AmbientEmitter : Dat151RelData { - public FlagsUint Unk00 { get; set; } - public FlagsUint Unk01 { get; set; } - public FlagsUint Unk02 { get; set; } + public FlagsUint Flags0 { get; set; } + public FlagsUint Flags1 { get; set; } + public FlagsUint Flags2 { get; set; } public Vector3 Position { get; set; } - public FlagsUint Unk03 { get; set; } //0 - public MetaHash Unk04 { get; set; } - public MetaHash Unk05 { get; set; } - public FlagsUint Unk06 { get; set; } //0 - public FlagsUint Unk07 { get; set; } //0xFFFFFFFF - public FlagsUint Unk08 { get; set; } //0 - public float Unk09 { get; set; } //1, 5, 100, ... + public FlagsUint Flags3 { get; set; } //0 + public MetaHash Hash1 { get; set; } + public MetaHash Hash2 { get; set; } + public FlagsUint Flags4 { get; set; } //0 + public FlagsUint Flags5 { get; set; } //0xFFFFFFFF + public FlagsUint Flags6 { get; set; } //0 + public float Unk01 { get; set; } //1, 5, 100, ... public float InnerRad { get; set; } //0, 4, ... 100 ... min value? public float OuterRad { get; set; } //15, 16, 12, 10, 20, 300 ... max value? - public FlagsByte Unk12 { get; set; } - public FlagsByte Unk13 { get; set; } //0,1,2,3,4,5 - public FlagsByte Unk14 { get; set; } - public FlagsByte Unk15 { get; set; } //0,1,2,3,4,5 - public FlagsUshort Unk16 { get; set; } //0..600 - public FlagsUshort Unk17 { get; set; } //0..150 - public FlagsByte Unk18 { get; set; } //0,1,2 - public FlagsByte Unk19 { get; set; } //0,1,2 - public FlagsByte Unk20 { get; set; } //1,2,3,4,8,255 - public FlagsByte Unk21 { get; set; } //1,2,3,4,5,6,8,10,255 - public FlagsByte Unk22 { get; set; } //0, 50, 80, 100 - public FlagsByte Unk23 { get; set; } //1,2,3,5 + public FlagsByte Unk02 { get; set; } + public FlagsByte Unk03 { get; set; } //0,1,2,3,4,5 + public FlagsByte Unk04 { get; set; } + public FlagsByte Unk05 { get; set; } //0,1,2,3,4,5 + public FlagsUshort Unk06 { get; set; } //0..600 + public FlagsUshort Unk07 { get; set; } //0..150 + public FlagsByte Unk08 { get; set; } //0,1,2 + public FlagsByte Unk09 { get; set; } //0,1,2 + public FlagsByte Unk10 { get; set; } //1,2,3,4,8,255 + public FlagsByte Unk11 { get; set; } //1,2,3,4,5,6,8,10,255 + public FlagsByte Unk12 { get; set; } //0, 50, 80, 100 + public FlagsByte Unk13 { get; set; } //1,2,3,5 public ushort ExtParamCount { get; set; } //0,1,2,4 public ExtParam[] ExtParams { get; set; } @@ -2930,33 +2941,38 @@ namespace CodeWalker.GameFiles } + public Dat151AmbientEmitter(RelFile rel) : base(rel) + { + Type = Dat151RelType.AmbientEmitter; + TypeID = (byte)Type; + } public Dat151AmbientEmitter(RelData d, BinaryReader br) : base(d, br) { - Unk00 = br.ReadUInt32(); - Unk01 = br.ReadUInt32(); - Unk02 = br.ReadUInt32(); + Flags0 = br.ReadUInt32(); + Flags1 = br.ReadUInt32(); + Flags2 = br.ReadUInt32(); Position = new Vector3(br.ReadSingle(), br.ReadSingle(), br.ReadSingle()); - Unk03 = br.ReadUInt32(); //0 - Unk04 = br.ReadUInt32(); - Unk05 = br.ReadUInt32(); - Unk06 = br.ReadUInt32(); //0 - Unk07 = br.ReadUInt32(); //0xFFFFFFFF - Unk08 = br.ReadUInt32(); //0 - Unk09 = br.ReadSingle(); //1, 5, 100, ... + Flags3 = br.ReadUInt32(); //0 + Hash1 = br.ReadUInt32(); + Hash2 = br.ReadUInt32(); + Flags4 = br.ReadUInt32(); //0 + Flags5 = br.ReadUInt32(); //0xFFFFFFFF + Flags6 = br.ReadUInt32(); //0 + Unk01 = br.ReadSingle(); //1, 5, 100, ... InnerRad = br.ReadSingle(); //0, 4, ... 100 ... min value? OuterRad = br.ReadSingle(); //15, 16, 12, 10, 20, 300 ... max value? - Unk12 = br.ReadByte(); - Unk13 = br.ReadByte(); //0,1,2,3,4,5 - Unk14 = br.ReadByte(); - Unk15 = br.ReadByte(); //0,1,2,3,4,5 - Unk16 = br.ReadUInt16(); //0..600 - Unk17 = br.ReadUInt16(); //0..150 - Unk18 = br.ReadByte(); //0,1,2 - Unk19 = br.ReadByte(); //0,1,2 - Unk20 = br.ReadByte(); //1,2,3,4,8,255 - Unk21 = br.ReadByte(); //1,2,3,4,5,6,8,10,255 - Unk22 = br.ReadByte(); //0, 50, 80, 100 - Unk23 = br.ReadByte(); //1,2,3,5 + Unk02 = br.ReadByte(); + Unk03 = br.ReadByte(); //0,1,2,3,4,5 + Unk04 = br.ReadByte(); + Unk05 = br.ReadByte(); //0,1,2,3,4,5 + Unk06 = br.ReadUInt16(); //0..600 + Unk07 = br.ReadUInt16(); //0..150 + Unk08 = br.ReadByte(); //0,1,2 + Unk09 = br.ReadByte(); //0,1,2 + Unk10 = br.ReadByte(); //1,2,3,4,8,255 + Unk11 = br.ReadByte(); //1,2,3,4,5,6,8,10,255 + Unk12 = br.ReadByte(); //0, 50, 80, 100 + Unk13 = br.ReadByte(); //1,2,3,5 ExtParamCount = br.ReadUInt16(); //0,1,2,4 if (ExtParamCount > 0) @@ -2970,7 +2986,7 @@ namespace CodeWalker.GameFiles int brem = (16 - ((ExtParamCount * 12) % 16)) % 16; if (brem > 0) { - byte[] brema = br.ReadBytes(brem); + //byte[] brema = br.ReadBytes(brem); //for (int i = 0; i < brem; i++) //{ // if (brema[i] != 0) @@ -2982,12 +2998,12 @@ namespace CodeWalker.GameFiles #region testing - switch (Unk12.Value)//no pattern? + switch (Unk02.Value)//no pattern? { default: break; } - switch (Unk13.Value) + switch (Unk03.Value) { case 0: case 1: @@ -2999,12 +3015,12 @@ namespace CodeWalker.GameFiles default: break; } - switch (Unk14.Value)//no pattern? + switch (Unk04.Value)//no pattern? { default: break; } - switch (Unk15.Value) + switch (Unk05.Value) { case 0: case 1: @@ -3016,7 +3032,7 @@ namespace CodeWalker.GameFiles default: break; } - switch (Unk16.Value) + switch (Unk06.Value) { case 0: case 1: @@ -3088,7 +3104,7 @@ namespace CodeWalker.GameFiles default: break; } - switch (Unk17.Value) + switch (Unk07.Value) { case 0: case 1: @@ -3121,7 +3137,7 @@ namespace CodeWalker.GameFiles default: break; } - switch (Unk18.Value) + switch (Unk08.Value) { case 0: case 1: @@ -3130,7 +3146,7 @@ namespace CodeWalker.GameFiles default: break; } - switch (Unk19.Value) + switch (Unk09.Value) { case 0: case 1: @@ -3139,7 +3155,7 @@ namespace CodeWalker.GameFiles default: break; } - switch (Unk20.Value) + switch (Unk10.Value) { case 1: case 2: @@ -3151,7 +3167,7 @@ namespace CodeWalker.GameFiles default: break; } - switch (Unk21.Value) + switch (Unk11.Value) { case 1: case 2: @@ -3166,7 +3182,7 @@ namespace CodeWalker.GameFiles default: break; } - switch (Unk22.Value) + switch (Unk12.Value) { case 0: case 50: @@ -3176,7 +3192,7 @@ namespace CodeWalker.GameFiles default: break; } - switch (Unk23.Value) + switch (Unk13.Value) { case 1: case 2: @@ -3218,33 +3234,33 @@ namespace CodeWalker.GameFiles //base.Write(bw); WriteTypeAndOffset(bw); - bw.Write(Unk00.Value); - bw.Write(Unk01.Value); - bw.Write(Unk02.Value); + bw.Write(Flags0.Value); + bw.Write(Flags1.Value); + bw.Write(Flags2.Value); bw.Write(Position.X); bw.Write(Position.Y); bw.Write(Position.Z); + bw.Write(Flags3.Value); + bw.Write(Hash1); + bw.Write(Hash2); + bw.Write(Flags4.Value); + bw.Write(Flags5.Value); + bw.Write(Flags6.Value); + bw.Write(Unk01); + bw.Write(InnerRad); + bw.Write(OuterRad); + bw.Write(Unk02.Value); bw.Write(Unk03.Value); - bw.Write(Unk04); - bw.Write(Unk05); + bw.Write(Unk04.Value); + bw.Write(Unk05.Value); bw.Write(Unk06.Value); bw.Write(Unk07.Value); bw.Write(Unk08.Value); - bw.Write(Unk09); - bw.Write(InnerRad); - bw.Write(OuterRad); + bw.Write(Unk09.Value); + bw.Write(Unk10.Value); + bw.Write(Unk11.Value); bw.Write(Unk12.Value); bw.Write(Unk13.Value); - bw.Write(Unk14.Value); - bw.Write(Unk15.Value); - bw.Write(Unk16.Value); - bw.Write(Unk17.Value); - bw.Write(Unk18.Value); - bw.Write(Unk19.Value); - bw.Write(Unk20.Value); - bw.Write(Unk21.Value); - bw.Write(Unk22.Value); - bw.Write(Unk23.Value); bw.Write(ExtParamCount); if (ExtParamCount > 0) @@ -3266,6 +3282,11 @@ namespace CodeWalker.GameFiles public uint ZoneCount { get; set; } public MetaHash[] ZoneHashes { get; set; } + public Dat151AmbientZoneList(RelFile rel) : base(rel) + { + Type = Dat151RelType.AmbientZoneList; + TypeID = (byte)Type; + } public Dat151AmbientZoneList(RelData d, BinaryReader br) : base(d, br) { ZoneCount = br.ReadUInt32(); @@ -3301,6 +3322,11 @@ namespace CodeWalker.GameFiles public uint AudioItemCount { get; set; } public Dat151HashPair[] AudioItems { get; set; } + public Dat151WeaponAudioItem(RelFile rel) : base(rel) + { + Type = Dat151RelType.WeaponAudioItem; + TypeID = (byte)Type; + } public Dat151WeaponAudioItem(RelData d, BinaryReader br) : base(d, br) { AudioTrack0 = br.ReadUInt32(); @@ -3358,6 +3384,11 @@ namespace CodeWalker.GameFiles public Dat151HashPair[] Items { get; set; } + public Dat151StartTrackAction(RelFile rel) : base(rel) + { + Type = Dat151RelType.StartTrackAction; + TypeID = (byte)Type; + } public Dat151StartTrackAction(RelData d, BinaryReader br) : base(d, br) { Unk0 = br.ReadUInt32(); @@ -3428,6 +3459,11 @@ namespace CodeWalker.GameFiles public int Unk3 { get; set; } public int Unk4 { get; set; } + public Dat151StopTrackAction(RelFile rel) : base(rel) + { + Type = Dat151RelType.StopTrackAction; + TypeID = (byte)Type; + } public Dat151StopTrackAction(RelData d, BinaryReader br) : base(d, br) { Unk0 = br.ReadUInt32(); @@ -3476,6 +3512,9 @@ namespace CodeWalker.GameFiles return AudioTrack0.ToString(); } + public Dat151MoodItem() + { + } public Dat151MoodItem(BinaryReader br) { AudioTrack0 = br.ReadUInt32(); @@ -3507,6 +3546,11 @@ namespace CodeWalker.GameFiles public uint MoodItemCount { get; set; } public Dat151MoodItem[] MoodItems { get; set; } + public Dat151Mood(RelFile rel) : base(rel) + { + Type = Dat151RelType.Mood; + TypeID = (byte)Type; + } public Dat151Mood(RelData d, BinaryReader br) : base(d, br) { Unk0 = br.ReadUInt32(); @@ -3565,6 +3609,11 @@ namespace CodeWalker.GameFiles public uint Unk5 { get; set; } public uint Unk6 { get; set; } + public Dat151SetMoodAction(RelFile rel) : base(rel) + { + Type = Dat151RelType.SetMoodAction; + TypeID = (byte)Type; + } public Dat151SetMoodAction(RelData d, BinaryReader br) : base(d, br) { Unk0 = br.ReadUInt32(); @@ -3607,6 +3656,11 @@ namespace CodeWalker.GameFiles public uint AudioTrackCount { get; set; } public MetaHash[] AudioTracks { get; set; } + public Dat151PlayerAction(RelFile rel) : base(rel) + { + Type = Dat151RelType.PlayerAction; + TypeID = (byte)Type; + } public Dat151PlayerAction(RelData d, BinaryReader br) : base(d, br) { AudioTrackCount = br.ReadUInt32(); @@ -3658,6 +3712,11 @@ namespace CodeWalker.GameFiles public int Unk7 { get; set; } public int Unk8 { get; set; } + public Dat151StartOneShotAction(RelFile rel) : base(rel) + { + Type = Dat151RelType.StartOneShotAction; + TypeID = (byte)Type; + } public Dat151StartOneShotAction(RelData d, BinaryReader br) : base(d, br) { Unk0 = br.ReadUInt32(); @@ -3706,6 +3765,11 @@ namespace CodeWalker.GameFiles public MetaHash AudioTrack1 { get; set; } public uint Unk3 { get; set; } + public Dat151StopOneShotAction(RelFile rel) : base(rel) + { + Type = Dat151RelType.StopOneShotAction; + TypeID = (byte)Type; + } public Dat151StopOneShotAction(RelData d, BinaryReader br) : base(d, br) { Unk0 = br.ReadUInt32(); @@ -3748,6 +3812,11 @@ namespace CodeWalker.GameFiles public float Unk3 { get; set; } public float Unk4 { get; set; } + public Dat151FadeInRadioAction(RelFile rel) : base(rel) + { + Type = Dat151RelType.FadeInRadioAction; + TypeID = (byte)Type; + } public Dat151FadeInRadioAction(RelData d, BinaryReader br) : base(d, br) { Unk0 = br.ReadUInt32(); @@ -3789,6 +3858,11 @@ namespace CodeWalker.GameFiles public float Unk3 { get; set; } public float Unk4 { get; set; } + public Dat151FadeOutRadioAction(RelFile rel) : base(rel) + { + Type = Dat151RelType.FadeOutRadioAction; + TypeID = (byte)Type; + } public Dat151FadeOutRadioAction(RelData d, BinaryReader br) : base(d, br) { Unk0 = br.ReadUInt32(); @@ -3844,6 +3918,11 @@ namespace CodeWalker.GameFiles public MetaHash[] AudioTracks2 { get; set; } + public Dat151Mod(RelFile rel) : base(rel) + { + Type = Dat151RelType.Mod; + TypeID = (byte)Type; + } public Dat151Mod(RelData d, BinaryReader br) : base(d, br) { Unk00 = br.ReadUInt32(); @@ -3991,6 +4070,11 @@ namespace CodeWalker.GameFiles public uint RoomsCount { get; set; } public MetaHash[] Rooms { get; set; } + public Dat151Interior(RelFile rel) : base(rel) + { + Type = Dat151RelType.Interior; + TypeID = (byte)Type; + } public Dat151Interior(RelData d, BinaryReader br) : base(d, br) { Unk0 = br.ReadUInt32(); @@ -4050,6 +4134,11 @@ namespace CodeWalker.GameFiles public MetaHash Unk13 { get; set; } public MetaHash Unk14 { get; set; } + public Dat151InteriorRoom(RelFile rel) : base(rel) + { + Type = Dat151RelType.InteriorRoom; + TypeID = (byte)Type; + } public Dat151InteriorRoom(RelData d, BinaryReader br) : base(d, br) { Unk00 = br.ReadUInt32(); @@ -4103,6 +4192,11 @@ namespace CodeWalker.GameFiles { public MetaHash AudioTrack0 { get; set; } + public Dat151Unk117(RelFile rel) : base(rel) + { + Type = Dat151RelType.Unk117; + TypeID = (byte)Type; + } public Dat151Unk117(RelData d, BinaryReader br) : base(d, br) { AudioTrack0 = br.ReadUInt32(); @@ -4218,6 +4312,11 @@ namespace CodeWalker.GameFiles public uint Unk88 { get; set; } public uint Unk89 { get; set; } + public Dat151Entity(RelFile rel) : base(rel) + { + Type = Dat151RelType.Entity; + TypeID = (byte)Type; + } public Dat151Entity(RelData d, BinaryReader br) : base(d, br) { Unk00 = br.ReadUInt32(); @@ -4478,6 +4577,11 @@ namespace CodeWalker.GameFiles public MetaHash AudioTrack0 { get; set; } public MetaHash AudioTrack1 { get; set; } + public Dat151Collision(RelFile rel) : base(rel) + { + Type = Dat151RelType.Collision; + TypeID = (byte)Type; + } public Dat151Collision(RelData d, BinaryReader br) : base(d, br) { Unk00 = br.ReadUInt32(); @@ -4614,6 +4718,11 @@ namespace CodeWalker.GameFiles public MetaHash AudioTrack0 { get; set; } public float Unk1 { get; set; } + public Dat151Unk47(RelFile rel) : base(rel) + { + Type = Dat151RelType.Unk47; + TypeID = (byte)Type; + } public Dat151Unk47(RelData d, BinaryReader br) : base(d, br) { Unk0 = br.ReadUInt32(); @@ -4642,6 +4751,11 @@ namespace CodeWalker.GameFiles public uint AudioItemCount { get; set; } public Dat151HashPair[] AudioItems { get; set; } + public Dat151Unk83(RelFile rel) : base(rel) + { + Type = Dat151RelType.Unk83; + TypeID = (byte)Type; + } public Dat151Unk83(RelData d, BinaryReader br) : base(d, br) { AudioItemCount = br.ReadUInt32(); @@ -4690,6 +4804,11 @@ namespace CodeWalker.GameFiles public uint AudioTracksCount { get; set; } public MetaHash[] AudioTracks { get; set; } + public Dat151ForceRadioTrackAction(RelFile rel) : base(rel) + { + Type = Dat151RelType.ForceRadioTrackAction; + TypeID = (byte)Type; + } public Dat151ForceRadioTrackAction(RelData d, BinaryReader br) : base(d, br) { Unk0 = br.ReadUInt32(); @@ -4753,6 +4872,11 @@ namespace CodeWalker.GameFiles public uint Unk4 { get; set; } public uint Unk5 { get; set; } + public Dat151RadioDjSpeechAction(RelFile rel) : base(rel) + { + Type = Dat151RelType.RadioDjSpeechAction; + TypeID = (byte)Type; + } public Dat151RadioDjSpeechAction(RelData d, BinaryReader br) : base(d, br) { Unk0 = br.ReadUInt32(); @@ -4791,6 +4915,11 @@ namespace CodeWalker.GameFiles public uint AudioItemCount { get; set; } public Dat151HashPair[] AudioItems { get; set; } + public Dat151Unk78(RelFile rel) : base(rel) + { + Type = Dat151RelType.Unk78; + TypeID = (byte)Type; + } public Dat151Unk78(RelData d, BinaryReader br) : base(d, br) { AudioItemCount = br.ReadUInt32(); @@ -4831,6 +4960,11 @@ namespace CodeWalker.GameFiles public uint AudioTracksCount { get; set; } public MetaHash[] AudioTracks { get; set; } + public Dat151RadioStationsDLC(RelFile rel) : base(rel) + { + Type = Dat151RelType.RadioStationsDLC; + TypeID = (byte)Type; + } public Dat151RadioStationsDLC(RelData d, BinaryReader br) : base(d, br) { AudioTracksCount = br.ReadUInt32(); @@ -4882,6 +5016,11 @@ namespace CodeWalker.GameFiles public uint AudioTracksCount { get; set; } public MetaHash[] AudioTracks { get; set; } + public Dat151RadioDLC(RelFile rel) : base(rel) + { + Type = Dat151RelType.RadioDLC; + TypeID = (byte)Type; + } public Dat151RadioDLC(RelData d, BinaryReader br) : base(d, br) { Unk00 = br.ReadUInt32(); @@ -4945,6 +5084,11 @@ namespace CodeWalker.GameFiles public uint AudioItemCount { get; set; } public Dat151HashPair[] AudioItems { get; set; } + public Dat151Unk49(RelFile rel) : base(rel) + { + Type = Dat151RelType.Unk49; + TypeID = (byte)Type; + } public Dat151Unk49(RelData d, BinaryReader br) : base(d, br) { AudioItemCount = br.ReadUInt32(); @@ -4985,6 +5129,11 @@ namespace CodeWalker.GameFiles public uint AudioItemCount { get; set; } public Dat151HashPair[] AudioItems { get; set; } + public Dat151Unk84(RelFile rel) : base(rel) + { + Type = Dat151RelType.Unk84; + TypeID = (byte)Type; + } public Dat151Unk84(RelData d, BinaryReader br) : base(d, br) { AudioItemCount = br.ReadUInt32(); @@ -5025,6 +5174,11 @@ namespace CodeWalker.GameFiles public uint AudioItemCount { get; set; } public Dat151HashPair[] AudioItems { get; set; } + public Dat151Unk86(RelFile rel) : base(rel) + { + Type = Dat151RelType.Unk86; + TypeID = (byte)Type; + } public Dat151Unk86(RelData d, BinaryReader br) : base(d, br) { AudioItemCount = br.ReadUInt32(); @@ -5065,6 +5219,11 @@ namespace CodeWalker.GameFiles public uint AudioItemCount { get; set; } public Dat151HashPair[] AudioItems { get; set; } + public Dat151Unk81(RelFile rel) : base(rel) + { + Type = Dat151RelType.Unk81; + TypeID = (byte)Type; + } public Dat151Unk81(RelData d, BinaryReader br) : base(d, br) { AudioItemCount = br.ReadUInt32(); @@ -5105,6 +5264,11 @@ namespace CodeWalker.GameFiles public uint AudioItemCount { get; set; } public Dat151HashPair[] AudioItems { get; set; } + public Dat151Unk55(RelFile rel) : base(rel) + { + Type = Dat151RelType.Unk55; + TypeID = (byte)Type; + } public Dat151Unk55(RelData d, BinaryReader br) : base(d, br) { AudioItemCount = br.ReadUInt32(); @@ -5159,6 +5323,11 @@ namespace CodeWalker.GameFiles public Vector2[] Points { get; set; } + public Dat151ShoreLinePool(RelFile rel) : base(rel) + { + Type = Dat151RelType.ShoreLinePool; + TypeID = (byte)Type; + } public Dat151ShoreLinePool(RelData d, BinaryReader br) : base(d, br) { Unk01 = br.ReadUInt32(); @@ -5224,6 +5393,11 @@ namespace CodeWalker.GameFiles public int PointsCount { get; set; } public Vector2[] Points { get; set; } + public Dat151ShoreLineLake(RelFile rel) : base(rel) + { + Type = Dat151RelType.ShoreLineLake; + TypeID = (byte)Type; + } public Dat151ShoreLineLake(RelData d, BinaryReader br) : base(d, br) { Unk01 = br.ReadUInt32(); @@ -5282,6 +5456,11 @@ namespace CodeWalker.GameFiles public uint PointsCount { get; set; } public Vector3[] Points { get; set; } + public Dat151ShoreLineRiver(RelFile rel) : base(rel) + { + Type = Dat151RelType.ShoreLineRiver; + TypeID = (byte)Type; + } public Dat151ShoreLineRiver(RelData d, BinaryReader br) : base(d, br) { Unk01 = br.ReadUInt32(); @@ -5343,6 +5522,11 @@ namespace CodeWalker.GameFiles public uint PointsCount { get; set; } public Vector2[] Points { get; set; } + public Dat151ShoreLineOcean(RelFile rel) : base(rel) + { + Type = Dat151RelType.ShoreLineOcean; + TypeID = (byte)Type; + } public Dat151ShoreLineOcean(RelData d, BinaryReader br) : base(d, br) { Unk01 = br.ReadUInt32(); @@ -5405,6 +5589,11 @@ namespace CodeWalker.GameFiles public uint ShoreLineCount { get; set; } public MetaHash[] ShoreLines { get; set; } + public Dat151ShoreLineList(RelFile rel) : base(rel) + { + Type = Dat151RelType.ShoreLineList; + TypeID = (byte)Type; + } public Dat151ShoreLineList(RelData d, BinaryReader br) : base(d, br) { ShoreLineCount = br.ReadUInt32(); @@ -5437,6 +5626,11 @@ namespace CodeWalker.GameFiles //[TC(typeof(EXP))] public class Dat151BlankTemplateItem : Dat151RelData //{ + // public Dat151BlankTemplateItem(RelFile rel) : base(rel) + // { + // Type = Dat151RelType.RELTYPE; + // TypeID = (byte)Type; + // } // public Dat151BlankTemplateItem(RelData d, BinaryReader br) : base(d, br) // { // var bytesleft = br.BaseStream.Length - br.BaseStream.Position; diff --git a/CodeWalker.Core/GameFiles/GameFileCache.cs b/CodeWalker.Core/GameFiles/GameFileCache.cs index baaef08..2e38f4e 100644 --- a/CodeWalker.Core/GameFiles/GameFileCache.cs +++ b/CodeWalker.Core/GameFiles/GameFileCache.cs @@ -2270,7 +2270,7 @@ namespace CodeWalker.GameFiles var sb2 = new StringBuilder(); foreach (var kvp in wavesmap) { - if (kvp.Key.FileType == RelDatFileType.Dat151Parameters) + if (kvp.Key.FileType == RelDatFileType.Dat151) { sb2.Append(((Dat151RelType)kvp.Key.ItemType).ToString()); sb2.Append(" "); diff --git a/Project/Panels/EditAudioEmitterListPanel.Designer.cs b/Project/Panels/EditAudioEmitterListPanel.Designer.cs index 33f21ff..27af500 100644 --- a/Project/Panels/EditAudioEmitterListPanel.Designer.cs +++ b/Project/Panels/EditAudioEmitterListPanel.Designer.cs @@ -29,20 +29,107 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditAudioEmitterListPanel)); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.label12 = new System.Windows.Forms.Label(); + this.NameTextBox = new System.Windows.Forms.TextBox(); + this.label19 = new System.Windows.Forms.Label(); + this.HashesTextBox = new CodeWalker.WinForms.TextBoxFix(); + this.tabControl1.SuspendLayout(); + this.tabPage1.SuspendLayout(); this.SuspendLayout(); // + // tabControl1 + // + this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Location = new System.Drawing.Point(2, 3); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(559, 446); + this.tabControl1.TabIndex = 1; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.label12); + this.tabPage1.Controls.Add(this.NameTextBox); + this.tabPage1.Controls.Add(this.label19); + this.tabPage1.Controls.Add(this.HashesTextBox); + this.tabPage1.Location = new System.Drawing.Point(4, 22); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(551, 420); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "Ambient Emitter List"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(26, 9); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(64, 13); + this.label12.TabIndex = 3; + this.label12.Text = "Name hash:"; + // + // NameTextBox + // + this.NameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.NameTextBox.Location = new System.Drawing.Point(103, 6); + this.NameTextBox.Name = "NameTextBox"; + this.NameTextBox.Size = new System.Drawing.Size(428, 20); + this.NameTextBox.TabIndex = 4; + this.NameTextBox.TextChanged += new System.EventHandler(this.NameTextBox_TextChanged); + // + // label19 + // + this.label19.AutoSize = true; + this.label19.Location = new System.Drawing.Point(11, 35); + this.label19.Name = "label19"; + this.label19.Size = new System.Drawing.Size(79, 13); + this.label19.TabIndex = 5; + this.label19.Text = "Emitter hashes:"; + // + // HashesTextBox + // + this.HashesTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.HashesTextBox.Location = new System.Drawing.Point(103, 32); + this.HashesTextBox.Multiline = true; + this.HashesTextBox.Name = "HashesTextBox"; + this.HashesTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both; + this.HashesTextBox.Size = new System.Drawing.Size(428, 330); + this.HashesTextBox.TabIndex = 6; + this.HashesTextBox.WordWrap = false; + this.HashesTextBox.TextChanged += new System.EventHandler(this.HashesTextBox_TextChanged); + // // EditAudioEmitterListPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(562, 450); + this.Controls.Add(this.tabControl1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "EditAudioEmitterListPanel"; this.Text = "Edit Audio Emitter List"; + this.tabControl1.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.tabPage1.PerformLayout(); this.ResumeLayout(false); } #endregion + + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.Label label19; + private WinForms.TextBoxFix HashesTextBox; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.TextBox NameTextBox; } } \ No newline at end of file diff --git a/Project/Panels/EditAudioEmitterListPanel.cs b/Project/Panels/EditAudioEmitterListPanel.cs index df1183d..f0e9446 100644 --- a/Project/Panels/EditAudioEmitterListPanel.cs +++ b/Project/Panels/EditAudioEmitterListPanel.cs @@ -16,6 +16,9 @@ namespace CodeWalker.Project.Panels public ProjectForm ProjectForm; public Dat151AmbientEmitterList CurrentEmitterList { get; set; } + private bool populatingui = false; + + public EditAudioEmitterListPanel(ProjectForm owner) { ProjectForm = owner; @@ -27,11 +30,115 @@ namespace CodeWalker.Project.Panels CurrentEmitterList = list; Tag = list; UpdateFormTitle(); + UpdateUI(); } private void UpdateFormTitle() { Text = CurrentEmitterList?.NameHash.ToString() ?? ""; } + + private void UpdateUI() + { + + if (CurrentEmitterList == null) + { + //AddToProjectButton.Enabled = false; + //DeleteButton.Enabled = false; + + populatingui = true; + NameTextBox.Text = string.Empty; + HashesTextBox.Text = string.Empty; + populatingui = false; + } + else + { + //AddToProjectButton.Enabled = CurrentZoneList?.Rel != null ? !ProjectForm.AudioFileExistsInProject(CurrentZoneList.Rel) : false; + //DeleteButton.Enabled = !AddToProjectButton.Enabled; + + populatingui = true; + var el = CurrentEmitterList; + + NameTextBox.Text = el.NameHash.ToString(); + + StringBuilder sb = new StringBuilder(); + if (el.EmitterHashes != null) + { + foreach (var hash in el.EmitterHashes) + { + sb.AppendLine(hash.ToString()); + } + } + HashesTextBox.Text = sb.ToString(); + + + populatingui = false; + + + } + + } + + + private void ProjectItemChanged() + { + if (CurrentEmitterList?.Rel != null) + { + ProjectForm.SetAudioFileHasChanged(true); + } + } + + + + private void NameTextBox_TextChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitterList == null) return; + + uint hash = 0; + string name = NameTextBox.Text; + if (!uint.TryParse(name, out hash))//don't re-hash hashes + { + hash = JenkHash.GenHash(name); + JenkIndex.Ensure(name); + } + //NameHashLabel.Text = "Hash: " + hash.ToString(); + + if (CurrentEmitterList.NameHash != hash) + { + CurrentEmitterList.Name = NameTextBox.Text; + CurrentEmitterList.NameHash = hash; + + ProjectItemChanged(); + UpdateFormTitle(); + } + } + + private void HashesTextBox_TextChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitterList == null) return; + + var hashstrs = HashesTextBox.Text.Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); + if (hashstrs?.Length > 0) + { + var hashlist = new List(); + foreach (var hashstr in hashstrs) + { + uint hash = 0; + if (!uint.TryParse(hashstr, out hash))//don't re-hash hashes + { + hash = JenkHash.GenHash(hashstr); + JenkIndex.Ensure(hashstr); + } + hashlist.Add(hash); + } + + CurrentEmitterList.EmitterHashes = hashlist.ToArray(); + CurrentEmitterList.EmitterCount = (byte)hashlist.Count; + + ProjectItemChanged(); + } + } } } diff --git a/Project/Panels/EditAudioEmitterPanel.Designer.cs b/Project/Panels/EditAudioEmitterPanel.Designer.cs index 5d1229e..38e18e2 100644 --- a/Project/Panels/EditAudioEmitterPanel.Designer.cs +++ b/Project/Panels/EditAudioEmitterPanel.Designer.cs @@ -29,20 +29,724 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditAudioEmitterPanel)); + this.GoToButton = new System.Windows.Forms.Button(); + this.tabControl1 = new System.Windows.Forms.TabControl(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.DeleteButton = new System.Windows.Forms.Button(); + this.AddToProjectButton = new System.Windows.Forms.Button(); + this.label21 = new System.Windows.Forms.Label(); + this.Flags2TextBox = new System.Windows.Forms.TextBox(); + this.label20 = new System.Windows.Forms.Label(); + this.ExtParamsTextBox = new CodeWalker.WinForms.TextBoxFix(); + this.label15 = new System.Windows.Forms.Label(); + this.label17 = new System.Windows.Forms.Label(); + this.label18 = new System.Windows.Forms.Label(); + this.label14 = new System.Windows.Forms.Label(); + this.Flags1TextBox = new System.Windows.Forms.TextBox(); + this.label13 = new System.Windows.Forms.Label(); + this.Flags0TextBox = new System.Windows.Forms.TextBox(); + this.label12 = new System.Windows.Forms.Label(); + this.NameTextBox = new System.Windows.Forms.TextBox(); + this.label6 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label10 = new System.Windows.Forms.Label(); + this.OuterRadTextBox = new System.Windows.Forms.TextBox(); + this.label4 = new System.Windows.Forms.Label(); + this.Unk01TextBox = new System.Windows.Forms.TextBox(); + this.label3 = new System.Windows.Forms.Label(); + this.Hash2TextBox = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.Hash1TextBox = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.InnerRadTextBox = new System.Windows.Forms.TextBox(); + this.label16 = new System.Windows.Forms.Label(); + this.PositionTextBox = new System.Windows.Forms.TextBox(); + this.label19 = new System.Windows.Forms.Label(); + this.Flags3TextBox = new System.Windows.Forms.TextBox(); + this.label22 = new System.Windows.Forms.Label(); + this.Flags4TextBox = new System.Windows.Forms.TextBox(); + this.label23 = new System.Windows.Forms.Label(); + this.Flags5TextBox = new System.Windows.Forms.TextBox(); + this.Unk02UpDown = new System.Windows.Forms.NumericUpDown(); + this.Unk03UpDown = new System.Windows.Forms.NumericUpDown(); + this.Unk04UpDown = new System.Windows.Forms.NumericUpDown(); + this.Unk05UpDown = new System.Windows.Forms.NumericUpDown(); + this.Unk06UpDown = new System.Windows.Forms.NumericUpDown(); + this.Unk08UpDown = new System.Windows.Forms.NumericUpDown(); + this.Unk07UpDown = new System.Windows.Forms.NumericUpDown(); + this.Unk09UpDown = new System.Windows.Forms.NumericUpDown(); + this.Unk10UpDown = new System.Windows.Forms.NumericUpDown(); + this.Unk11UpDown = new System.Windows.Forms.NumericUpDown(); + this.Unk12UpDown = new System.Windows.Forms.NumericUpDown(); + this.Unk13UpDown = new System.Windows.Forms.NumericUpDown(); + this.tabControl1.SuspendLayout(); + this.tabPage1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.Unk02UpDown)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.Unk03UpDown)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.Unk04UpDown)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.Unk05UpDown)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.Unk06UpDown)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.Unk08UpDown)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.Unk07UpDown)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.Unk09UpDown)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.Unk10UpDown)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.Unk11UpDown)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.Unk12UpDown)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.Unk13UpDown)).BeginInit(); this.SuspendLayout(); // + // GoToButton + // + this.GoToButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.GoToButton.Location = new System.Drawing.Point(483, 0); + this.GoToButton.Name = "GoToButton"; + this.GoToButton.Size = new System.Drawing.Size(68, 23); + this.GoToButton.TabIndex = 10; + this.GoToButton.Text = "Go to"; + this.GoToButton.UseVisualStyleBackColor = true; + this.GoToButton.Click += new System.EventHandler(this.GoToButton_Click); + // + // tabControl1 + // + this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tabControl1.Controls.Add(this.tabPage1); + this.tabControl1.Location = new System.Drawing.Point(2, 3); + this.tabControl1.Name = "tabControl1"; + this.tabControl1.SelectedIndex = 0; + this.tabControl1.Size = new System.Drawing.Size(559, 447); + this.tabControl1.TabIndex = 20; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.Unk13UpDown); + this.tabPage1.Controls.Add(this.Unk12UpDown); + this.tabPage1.Controls.Add(this.Unk11UpDown); + this.tabPage1.Controls.Add(this.Unk10UpDown); + this.tabPage1.Controls.Add(this.Unk09UpDown); + this.tabPage1.Controls.Add(this.Unk07UpDown); + this.tabPage1.Controls.Add(this.Unk08UpDown); + this.tabPage1.Controls.Add(this.Unk06UpDown); + this.tabPage1.Controls.Add(this.Unk05UpDown); + this.tabPage1.Controls.Add(this.Unk04UpDown); + this.tabPage1.Controls.Add(this.Unk03UpDown); + this.tabPage1.Controls.Add(this.Unk02UpDown); + this.tabPage1.Controls.Add(this.label23); + this.tabPage1.Controls.Add(this.Flags5TextBox); + this.tabPage1.Controls.Add(this.label22); + this.tabPage1.Controls.Add(this.Flags4TextBox); + this.tabPage1.Controls.Add(this.label19); + this.tabPage1.Controls.Add(this.Flags3TextBox); + this.tabPage1.Controls.Add(this.DeleteButton); + this.tabPage1.Controls.Add(this.AddToProjectButton); + this.tabPage1.Controls.Add(this.label21); + this.tabPage1.Controls.Add(this.Flags2TextBox); + this.tabPage1.Controls.Add(this.label20); + this.tabPage1.Controls.Add(this.ExtParamsTextBox); + this.tabPage1.Controls.Add(this.label15); + this.tabPage1.Controls.Add(this.label17); + this.tabPage1.Controls.Add(this.label18); + this.tabPage1.Controls.Add(this.label14); + this.tabPage1.Controls.Add(this.Flags1TextBox); + this.tabPage1.Controls.Add(this.label13); + this.tabPage1.Controls.Add(this.Flags0TextBox); + this.tabPage1.Controls.Add(this.label12); + this.tabPage1.Controls.Add(this.NameTextBox); + this.tabPage1.Controls.Add(this.label6); + this.tabPage1.Controls.Add(this.label7); + this.tabPage1.Controls.Add(this.label10); + this.tabPage1.Controls.Add(this.OuterRadTextBox); + this.tabPage1.Controls.Add(this.label4); + this.tabPage1.Controls.Add(this.Unk01TextBox); + this.tabPage1.Controls.Add(this.label3); + this.tabPage1.Controls.Add(this.Hash2TextBox); + this.tabPage1.Controls.Add(this.label2); + this.tabPage1.Controls.Add(this.Hash1TextBox); + this.tabPage1.Controls.Add(this.label1); + this.tabPage1.Controls.Add(this.InnerRadTextBox); + this.tabPage1.Controls.Add(this.label16); + this.tabPage1.Controls.Add(this.PositionTextBox); + this.tabPage1.Location = new System.Drawing.Point(4, 22); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(551, 421); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "Ambient Emitter"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // DeleteButton + // + this.DeleteButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.DeleteButton.Location = new System.Drawing.Point(343, 3); + this.DeleteButton.Name = "DeleteButton"; + this.DeleteButton.Size = new System.Drawing.Size(93, 23); + this.DeleteButton.TabIndex = 75; + this.DeleteButton.Text = "Delete emitter"; + this.DeleteButton.UseVisualStyleBackColor = true; + this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click); + // + // AddToProjectButton + // + this.AddToProjectButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.AddToProjectButton.Location = new System.Drawing.Point(452, 3); + this.AddToProjectButton.Name = "AddToProjectButton"; + this.AddToProjectButton.Size = new System.Drawing.Size(93, 23); + this.AddToProjectButton.TabIndex = 74; + this.AddToProjectButton.Text = "Add to project"; + this.AddToProjectButton.UseVisualStyleBackColor = true; + this.AddToProjectButton.Click += new System.EventHandler(this.AddToProjectButton_Click); + // + // label21 + // + this.label21.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.label21.AutoSize = true; + this.label21.Location = new System.Drawing.Point(340, 106); + this.label21.Name = "label21"; + this.label21.Size = new System.Drawing.Size(44, 13); + this.label21.TabIndex = 64; + this.label21.Text = "Flags 2:"; + // + // Flags2TextBox + // + this.Flags2TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.Flags2TextBox.Location = new System.Drawing.Point(390, 103); + this.Flags2TextBox.Name = "Flags2TextBox"; + this.Flags2TextBox.Size = new System.Drawing.Size(155, 20); + this.Flags2TextBox.TabIndex = 65; + this.Flags2TextBox.TextChanged += new System.EventHandler(this.Flags2TextBox_TextChanged); + // + // label20 + // + this.label20.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.label20.AutoSize = true; + this.label20.Location = new System.Drawing.Point(305, 241); + this.label20.Name = "label20"; + this.label20.Size = new System.Drawing.Size(160, 26); + this.label20.TabIndex = 72; + this.label20.Text = "Ext params:\r\nName (hash), Value (float), Flags"; + // + // ExtParamsTextBox + // + this.ExtParamsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.ExtParamsTextBox.Location = new System.Drawing.Point(282, 271); + this.ExtParamsTextBox.Multiline = true; + this.ExtParamsTextBox.Name = "ExtParamsTextBox"; + this.ExtParamsTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both; + this.ExtParamsTextBox.Size = new System.Drawing.Size(262, 140); + this.ExtParamsTextBox.TabIndex = 73; + this.ExtParamsTextBox.WordWrap = false; + this.ExtParamsTextBox.TextChanged += new System.EventHandler(this.ExtParamsTextBox_TextChanged); + // + // label15 + // + this.label15.AutoSize = true; + this.label15.Location = new System.Drawing.Point(7, 274); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(63, 13); + this.label15.TabIndex = 57; + this.label15.Text = "Unk 12, 13:"; + // + // label17 + // + this.label17.AutoSize = true; + this.label17.Location = new System.Drawing.Point(7, 250); + this.label17.Name = "label17"; + this.label17.Size = new System.Drawing.Size(63, 13); + this.label17.TabIndex = 54; + this.label17.Text = "Unk 10, 11:"; + // + // label18 + // + this.label18.AutoSize = true; + this.label18.Location = new System.Drawing.Point(7, 226); + this.label18.Name = "label18"; + this.label18.Size = new System.Drawing.Size(51, 13); + this.label18.TabIndex = 51; + this.label18.Text = "Unk 8, 9:"; + // + // label14 + // + this.label14.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.label14.AutoSize = true; + this.label14.Location = new System.Drawing.Point(340, 82); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(44, 13); + this.label14.TabIndex = 62; + this.label14.Text = "Flags 1:"; + // + // Flags1TextBox + // + this.Flags1TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.Flags1TextBox.Location = new System.Drawing.Point(390, 79); + this.Flags1TextBox.Name = "Flags1TextBox"; + this.Flags1TextBox.Size = new System.Drawing.Size(155, 20); + this.Flags1TextBox.TabIndex = 63; + this.Flags1TextBox.TextChanged += new System.EventHandler(this.Flags1TextBox_TextChanged); + // + // label13 + // + this.label13.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.label13.AutoSize = true; + this.label13.Location = new System.Drawing.Point(340, 58); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(44, 13); + this.label13.TabIndex = 60; + this.label13.Text = "Flags 0:"; + // + // Flags0TextBox + // + this.Flags0TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.Flags0TextBox.Location = new System.Drawing.Point(390, 55); + this.Flags0TextBox.Name = "Flags0TextBox"; + this.Flags0TextBox.Size = new System.Drawing.Size(155, 20); + this.Flags0TextBox.TabIndex = 61; + this.Flags0TextBox.TextChanged += new System.EventHandler(this.Flags0TextBox_TextChanged); + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(7, 9); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(64, 13); + this.label12.TabIndex = 29; + this.label12.Text = "Name hash:"; + // + // NameTextBox + // + this.NameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.NameTextBox.Location = new System.Drawing.Point(84, 6); + this.NameTextBox.Name = "NameTextBox"; + this.NameTextBox.Size = new System.Drawing.Size(237, 20); + this.NameTextBox.TabIndex = 30; + this.NameTextBox.TextChanged += new System.EventHandler(this.NameTextBox_TextChanged); + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(7, 202); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(51, 13); + this.label6.TabIndex = 48; + this.label6.Text = "Unk 6, 7:"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(7, 178); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(75, 13); + this.label7.TabIndex = 43; + this.label7.Text = "Unk 2, 3, 4, 5:"; + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(7, 81); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(67, 13); + this.label10.TabIndex = 35; + this.label10.Text = "Outer radius:"; + // + // OuterRadTextBox + // + this.OuterRadTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.OuterRadTextBox.Location = new System.Drawing.Point(84, 78); + this.OuterRadTextBox.Name = "OuterRadTextBox"; + this.OuterRadTextBox.Size = new System.Drawing.Size(237, 20); + this.OuterRadTextBox.TabIndex = 36; + this.OuterRadTextBox.TextChanged += new System.EventHandler(this.OuterRadTextBox_TextChanged); + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(7, 154); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(39, 13); + this.label4.TabIndex = 41; + this.label4.Text = "Unk 1:"; + // + // Unk01TextBox + // + this.Unk01TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.Unk01TextBox.Location = new System.Drawing.Point(84, 151); + this.Unk01TextBox.Name = "Unk01TextBox"; + this.Unk01TextBox.Size = new System.Drawing.Size(237, 20); + this.Unk01TextBox.TabIndex = 42; + this.Unk01TextBox.TextChanged += new System.EventHandler(this.Unk01TextBox_TextChanged); + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(7, 130); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(44, 13); + this.label3.TabIndex = 39; + this.label3.Text = "Hash 2:"; + // + // Hash2TextBox + // + this.Hash2TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.Hash2TextBox.Location = new System.Drawing.Point(84, 127); + this.Hash2TextBox.Name = "Hash2TextBox"; + this.Hash2TextBox.Size = new System.Drawing.Size(237, 20); + this.Hash2TextBox.TabIndex = 40; + this.Hash2TextBox.TextChanged += new System.EventHandler(this.Hash2TextBox_TextChanged); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(7, 106); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(44, 13); + this.label2.TabIndex = 37; + this.label2.Text = "Hash 1:"; + // + // Hash1TextBox + // + this.Hash1TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.Hash1TextBox.Location = new System.Drawing.Point(84, 103); + this.Hash1TextBox.Name = "Hash1TextBox"; + this.Hash1TextBox.Size = new System.Drawing.Size(237, 20); + this.Hash1TextBox.TabIndex = 38; + this.Hash1TextBox.TextChanged += new System.EventHandler(this.Hash1TextBox_TextChanged); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(7, 57); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(65, 13); + this.label1.TabIndex = 33; + this.label1.Text = "Inner radius:"; + // + // InnerRadTextBox + // + this.InnerRadTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.InnerRadTextBox.Location = new System.Drawing.Point(84, 54); + this.InnerRadTextBox.Name = "InnerRadTextBox"; + this.InnerRadTextBox.Size = new System.Drawing.Size(237, 20); + this.InnerRadTextBox.TabIndex = 34; + this.InnerRadTextBox.TextChanged += new System.EventHandler(this.InnerRadTextBox_TextChanged); + // + // label16 + // + this.label16.AutoSize = true; + this.label16.Location = new System.Drawing.Point(7, 33); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(47, 13); + this.label16.TabIndex = 31; + this.label16.Text = "Position:"; + // + // PositionTextBox + // + this.PositionTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.PositionTextBox.Location = new System.Drawing.Point(84, 30); + this.PositionTextBox.Name = "PositionTextBox"; + this.PositionTextBox.Size = new System.Drawing.Size(237, 20); + this.PositionTextBox.TabIndex = 32; + this.PositionTextBox.TextChanged += new System.EventHandler(this.PositionTextBox_TextChanged); + // + // label19 + // + this.label19.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.label19.AutoSize = true; + this.label19.Location = new System.Drawing.Point(340, 130); + this.label19.Name = "label19"; + this.label19.Size = new System.Drawing.Size(44, 13); + this.label19.TabIndex = 66; + this.label19.Text = "Flags 3:"; + // + // Flags3TextBox + // + this.Flags3TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.Flags3TextBox.Location = new System.Drawing.Point(390, 127); + this.Flags3TextBox.Name = "Flags3TextBox"; + this.Flags3TextBox.Size = new System.Drawing.Size(155, 20); + this.Flags3TextBox.TabIndex = 67; + this.Flags3TextBox.TextChanged += new System.EventHandler(this.Flags3TextBox_TextChanged); + // + // label22 + // + this.label22.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.label22.AutoSize = true; + this.label22.Location = new System.Drawing.Point(340, 154); + this.label22.Name = "label22"; + this.label22.Size = new System.Drawing.Size(44, 13); + this.label22.TabIndex = 68; + this.label22.Text = "Flags 4:"; + // + // Flags4TextBox + // + this.Flags4TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.Flags4TextBox.Location = new System.Drawing.Point(390, 151); + this.Flags4TextBox.Name = "Flags4TextBox"; + this.Flags4TextBox.Size = new System.Drawing.Size(155, 20); + this.Flags4TextBox.TabIndex = 69; + this.Flags4TextBox.TextChanged += new System.EventHandler(this.Flags4TextBox_TextChanged); + // + // label23 + // + this.label23.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.label23.AutoSize = true; + this.label23.Location = new System.Drawing.Point(340, 178); + this.label23.Name = "label23"; + this.label23.Size = new System.Drawing.Size(44, 13); + this.label23.TabIndex = 70; + this.label23.Text = "Flags 5:"; + // + // Flags5TextBox + // + this.Flags5TextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.Flags5TextBox.Location = new System.Drawing.Point(390, 175); + this.Flags5TextBox.Name = "Flags5TextBox"; + this.Flags5TextBox.Size = new System.Drawing.Size(155, 20); + this.Flags5TextBox.TabIndex = 71; + this.Flags5TextBox.TextChanged += new System.EventHandler(this.Flags5TextBox_TextChanged); + // + // Unk02UpDown + // + this.Unk02UpDown.Location = new System.Drawing.Point(84, 175); + this.Unk02UpDown.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.Unk02UpDown.Name = "Unk02UpDown"; + this.Unk02UpDown.Size = new System.Drawing.Size(48, 20); + this.Unk02UpDown.TabIndex = 44; + this.Unk02UpDown.ValueChanged += new System.EventHandler(this.Unk02UpDown_ValueChanged); + // + // Unk03UpDown + // + this.Unk03UpDown.Location = new System.Drawing.Point(138, 175); + this.Unk03UpDown.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.Unk03UpDown.Name = "Unk03UpDown"; + this.Unk03UpDown.Size = new System.Drawing.Size(48, 20); + this.Unk03UpDown.TabIndex = 45; + this.Unk03UpDown.ValueChanged += new System.EventHandler(this.Unk03UpDown_ValueChanged); + // + // Unk04UpDown + // + this.Unk04UpDown.Location = new System.Drawing.Point(192, 175); + this.Unk04UpDown.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.Unk04UpDown.Name = "Unk04UpDown"; + this.Unk04UpDown.Size = new System.Drawing.Size(48, 20); + this.Unk04UpDown.TabIndex = 46; + this.Unk04UpDown.ValueChanged += new System.EventHandler(this.Unk04UpDown_ValueChanged); + // + // Unk05UpDown + // + this.Unk05UpDown.Location = new System.Drawing.Point(246, 175); + this.Unk05UpDown.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.Unk05UpDown.Name = "Unk05UpDown"; + this.Unk05UpDown.Size = new System.Drawing.Size(48, 20); + this.Unk05UpDown.TabIndex = 47; + this.Unk05UpDown.ValueChanged += new System.EventHandler(this.Unk05UpDown_ValueChanged); + // + // Unk06UpDown + // + this.Unk06UpDown.Location = new System.Drawing.Point(84, 199); + this.Unk06UpDown.Maximum = new decimal(new int[] { + 65535, + 0, + 0, + 0}); + this.Unk06UpDown.Name = "Unk06UpDown"; + this.Unk06UpDown.Size = new System.Drawing.Size(102, 20); + this.Unk06UpDown.TabIndex = 49; + this.Unk06UpDown.ValueChanged += new System.EventHandler(this.Unk06UpDown_ValueChanged); + // + // Unk08UpDown + // + this.Unk08UpDown.Location = new System.Drawing.Point(84, 223); + this.Unk08UpDown.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.Unk08UpDown.Name = "Unk08UpDown"; + this.Unk08UpDown.Size = new System.Drawing.Size(48, 20); + this.Unk08UpDown.TabIndex = 52; + this.Unk08UpDown.ValueChanged += new System.EventHandler(this.Unk08UpDown_ValueChanged); + // + // Unk07UpDown + // + this.Unk07UpDown.Location = new System.Drawing.Point(192, 199); + this.Unk07UpDown.Maximum = new decimal(new int[] { + 65535, + 0, + 0, + 0}); + this.Unk07UpDown.Name = "Unk07UpDown"; + this.Unk07UpDown.Size = new System.Drawing.Size(102, 20); + this.Unk07UpDown.TabIndex = 50; + this.Unk07UpDown.ValueChanged += new System.EventHandler(this.Unk07UpDown_ValueChanged); + // + // Unk09UpDown + // + this.Unk09UpDown.Location = new System.Drawing.Point(138, 223); + this.Unk09UpDown.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.Unk09UpDown.Name = "Unk09UpDown"; + this.Unk09UpDown.Size = new System.Drawing.Size(48, 20); + this.Unk09UpDown.TabIndex = 53; + this.Unk09UpDown.ValueChanged += new System.EventHandler(this.Unk09UpDown_ValueChanged); + // + // Unk10UpDown + // + this.Unk10UpDown.Location = new System.Drawing.Point(84, 247); + this.Unk10UpDown.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.Unk10UpDown.Name = "Unk10UpDown"; + this.Unk10UpDown.Size = new System.Drawing.Size(48, 20); + this.Unk10UpDown.TabIndex = 55; + this.Unk10UpDown.ValueChanged += new System.EventHandler(this.Unk10UpDown_ValueChanged); + // + // Unk11UpDown + // + this.Unk11UpDown.Location = new System.Drawing.Point(138, 247); + this.Unk11UpDown.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.Unk11UpDown.Name = "Unk11UpDown"; + this.Unk11UpDown.Size = new System.Drawing.Size(48, 20); + this.Unk11UpDown.TabIndex = 56; + this.Unk11UpDown.ValueChanged += new System.EventHandler(this.Unk11UpDown_ValueChanged); + // + // Unk12UpDown + // + this.Unk12UpDown.Location = new System.Drawing.Point(84, 271); + this.Unk12UpDown.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.Unk12UpDown.Name = "Unk12UpDown"; + this.Unk12UpDown.Size = new System.Drawing.Size(48, 20); + this.Unk12UpDown.TabIndex = 58; + this.Unk12UpDown.ValueChanged += new System.EventHandler(this.Unk12UpDown_ValueChanged); + // + // Unk13UpDown + // + this.Unk13UpDown.Location = new System.Drawing.Point(138, 271); + this.Unk13UpDown.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.Unk13UpDown.Name = "Unk13UpDown"; + this.Unk13UpDown.Size = new System.Drawing.Size(48, 20); + this.Unk13UpDown.TabIndex = 59; + this.Unk13UpDown.ValueChanged += new System.EventHandler(this.Unk13UpDown_ValueChanged); + // // EditAudioEmitterPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(562, 450); + this.Controls.Add(this.GoToButton); + this.Controls.Add(this.tabControl1); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "EditAudioEmitterPanel"; this.Text = "Edit Audio Emitter"; + this.tabControl1.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.tabPage1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.Unk02UpDown)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.Unk03UpDown)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.Unk04UpDown)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.Unk05UpDown)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.Unk06UpDown)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.Unk08UpDown)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.Unk07UpDown)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.Unk09UpDown)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.Unk10UpDown)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.Unk11UpDown)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.Unk12UpDown)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.Unk13UpDown)).EndInit(); this.ResumeLayout(false); } #endregion + + private System.Windows.Forms.Button GoToButton; + private System.Windows.Forms.TabControl tabControl1; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.Button DeleteButton; + private System.Windows.Forms.Button AddToProjectButton; + private System.Windows.Forms.Label label21; + private System.Windows.Forms.TextBox Flags2TextBox; + private System.Windows.Forms.Label label20; + private WinForms.TextBoxFix ExtParamsTextBox; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.Label label17; + private System.Windows.Forms.Label label18; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.TextBox Flags1TextBox; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.TextBox Flags0TextBox; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.TextBox NameTextBox; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.TextBox OuterRadTextBox; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.TextBox Unk01TextBox; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.TextBox Hash2TextBox; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox Hash1TextBox; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox InnerRadTextBox; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.TextBox PositionTextBox; + private System.Windows.Forms.Label label23; + private System.Windows.Forms.TextBox Flags5TextBox; + private System.Windows.Forms.Label label22; + private System.Windows.Forms.TextBox Flags4TextBox; + private System.Windows.Forms.Label label19; + private System.Windows.Forms.TextBox Flags3TextBox; + private System.Windows.Forms.NumericUpDown Unk06UpDown; + private System.Windows.Forms.NumericUpDown Unk05UpDown; + private System.Windows.Forms.NumericUpDown Unk04UpDown; + private System.Windows.Forms.NumericUpDown Unk03UpDown; + private System.Windows.Forms.NumericUpDown Unk02UpDown; + private System.Windows.Forms.NumericUpDown Unk07UpDown; + private System.Windows.Forms.NumericUpDown Unk08UpDown; + private System.Windows.Forms.NumericUpDown Unk13UpDown; + private System.Windows.Forms.NumericUpDown Unk12UpDown; + private System.Windows.Forms.NumericUpDown Unk11UpDown; + private System.Windows.Forms.NumericUpDown Unk10UpDown; + private System.Windows.Forms.NumericUpDown Unk09UpDown; } } \ No newline at end of file diff --git a/Project/Panels/EditAudioEmitterPanel.cs b/Project/Panels/EditAudioEmitterPanel.cs index d206cf3..532746f 100644 --- a/Project/Panels/EditAudioEmitterPanel.cs +++ b/Project/Panels/EditAudioEmitterPanel.cs @@ -1,9 +1,11 @@ -using CodeWalker.World; +using CodeWalker.GameFiles; +using CodeWalker.World; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; +using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -16,6 +18,9 @@ namespace CodeWalker.Project.Panels public ProjectForm ProjectForm; public AudioPlacement CurrentEmitter { get; set; } + private bool populatingui = false; + + public EditAudioEmitterPanel(ProjectForm owner) { ProjectForm = owner; @@ -27,6 +32,7 @@ namespace CodeWalker.Project.Panels CurrentEmitter = emitter; Tag = emitter; UpdateFormTitle(); + UpdateUI(); } private void UpdateFormTitle() @@ -34,5 +40,573 @@ namespace CodeWalker.Project.Panels Text = CurrentEmitter?.NameHash.ToString() ?? ""; } + + 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; + Hash1TextBox.Text = string.Empty; + Hash2TextBox.Text = string.Empty; + Unk01TextBox.Text = string.Empty; + Unk02UpDown.Value = 0; + Unk03UpDown.Value = 0; + Unk04UpDown.Value = 0; + Unk05UpDown.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); + Hash1TextBox.Text = e.Hash1.ToString(); + Hash2TextBox.Text = e.Hash2.ToString(); + Unk01TextBox.Text = FloatUtil.ToString(e.Unk01); + Unk02UpDown.Value = e.Unk02.Value; + Unk03UpDown.Value = e.Unk03.Value; + Unk04UpDown.Value = e.Unk04.Value; + Unk05UpDown.Value = e.Unk05.Value; + 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.SelectAudio(CurrentEmitter); + } + + } + } + + private void ProjectItemChanged() + { + CurrentEmitter?.UpdateFromEmitter();//also update the placement wrapper + + if (CurrentEmitter?.RelFile != null) + { + ProjectForm.SetAudioFileHasChanged(true); + } + } + + + private void NameTextBox_TextChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitter?.AudioEmitter == null) return; + + uint hash = 0; + string name = NameTextBox.Text; + if (!uint.TryParse(name, out hash))//don't re-hash hashes + { + hash = JenkHash.GenHash(name); + JenkIndex.Ensure(name); + } + //NameHashLabel.Text = "Hash: " + hash.ToString(); + + if (CurrentEmitter.AudioEmitter.NameHash != hash) + { + CurrentEmitter.AudioEmitter.Name = NameTextBox.Text; + CurrentEmitter.AudioEmitter.NameHash = hash; + + ProjectItemChanged(); + UpdateFormTitle(); + } + } + + private void PositionTextBox_TextChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitter?.AudioEmitter == null) return; + + var vec = FloatUtil.ParseVector3String(PositionTextBox.Text); + if (CurrentEmitter.AudioEmitter.Position != vec) + { + CurrentEmitter.AudioEmitter.Position = vec; + + ProjectItemChanged(); + + //var wf = ProjectForm.WorldForm; + //if (wf != null) + //{ + // wf.BeginInvoke(new Action(() => + // { + // wf.SetWidgetPosition(CurrentEmitter.Position, true); + // })); + //} + } + } + + private void InnerRadTextBox_TextChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitter?.AudioEmitter == null) return; + + float rad = FloatUtil.Parse(InnerRadTextBox.Text); + if (CurrentEmitter.AudioEmitter.InnerRad != rad) + { + CurrentEmitter.AudioEmitter.InnerRad = rad; + + ProjectItemChanged(); + } + } + + private void OuterRadTextBox_TextChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitter?.AudioEmitter == null) return; + + float rad = FloatUtil.Parse(OuterRadTextBox.Text); + if (CurrentEmitter.AudioEmitter.OuterRad != rad) + { + CurrentEmitter.AudioEmitter.OuterRad = rad; + + ProjectItemChanged(); + } + } + + private void Hash1TextBox_TextChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitter?.AudioEmitter == null) return; + + uint hash = 0; + string name = Hash1TextBox.Text; + if (!uint.TryParse(name, out hash))//don't re-hash hashes + { + hash = JenkHash.GenHash(name); + JenkIndex.Ensure(name); + } + //HashLabel.Text = "Hash: " + hash.ToString(); + + if (CurrentEmitter.AudioEmitter.Hash1 != hash) + { + CurrentEmitter.AudioEmitter.Hash1 = hash; + + ProjectItemChanged(); + } + } + + private void Hash2TextBox_TextChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitter?.AudioEmitter == null) return; + + uint hash = 0; + string name = Hash2TextBox.Text; + if (!uint.TryParse(name, out hash))//don't re-hash hashes + { + hash = JenkHash.GenHash(name); + JenkIndex.Ensure(name); + } + //HashLabel.Text = "Hash: " + hash.ToString(); + + if (CurrentEmitter.AudioEmitter.Hash2 != hash) + { + CurrentEmitter.AudioEmitter.Hash2 = hash; + + ProjectItemChanged(); + } + } + + private void Unk01TextBox_TextChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitter?.AudioEmitter == null) return; + + float unk = FloatUtil.Parse(Unk01TextBox.Text); + if (CurrentEmitter.AudioEmitter.Unk01 != unk) + { + CurrentEmitter.AudioEmitter.Unk01 = unk; + + ProjectItemChanged(); + } + } + + private void Unk02UpDown_ValueChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitter?.AudioEmitter == null) return; + + byte unk = (byte)Unk02UpDown.Value; + if (CurrentEmitter.AudioEmitter.Unk02.Value != unk) + { + CurrentEmitter.AudioEmitter.Unk02 = unk; + + ProjectItemChanged(); + } + } + + private void Unk03UpDown_ValueChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitter?.AudioEmitter == null) return; + + byte unk = (byte)Unk03UpDown.Value; + if (CurrentEmitter.AudioEmitter.Unk03.Value != unk) + { + CurrentEmitter.AudioEmitter.Unk03 = unk; + + ProjectItemChanged(); + } + } + + private void Unk04UpDown_ValueChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitter?.AudioEmitter == null) return; + + byte unk = (byte)Unk04UpDown.Value; + if (CurrentEmitter.AudioEmitter.Unk04.Value != unk) + { + CurrentEmitter.AudioEmitter.Unk04 = unk; + + ProjectItemChanged(); + } + } + + private void Unk05UpDown_ValueChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitter?.AudioEmitter == null) return; + + byte unk = (byte)Unk05UpDown.Value; + if (CurrentEmitter.AudioEmitter.Unk05.Value != unk) + { + CurrentEmitter.AudioEmitter.Unk05 = unk; + + ProjectItemChanged(); + } + } + + private void Unk06UpDown_ValueChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitter?.AudioEmitter == null) return; + + ushort unk = (ushort)Unk06UpDown.Value; + if (CurrentEmitter.AudioEmitter.Unk06.Value != unk) + { + CurrentEmitter.AudioEmitter.Unk06 = unk; + + ProjectItemChanged(); + } + } + + private void Unk07UpDown_ValueChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitter?.AudioEmitter == null) return; + + ushort unk = (ushort)Unk07UpDown.Value; + if (CurrentEmitter.AudioEmitter.Unk07.Value != unk) + { + CurrentEmitter.AudioEmitter.Unk07 = unk; + + ProjectItemChanged(); + } + } + + private void Unk08UpDown_ValueChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitter?.AudioEmitter == null) return; + + byte unk = (byte)Unk08UpDown.Value; + if (CurrentEmitter.AudioEmitter.Unk08.Value != unk) + { + CurrentEmitter.AudioEmitter.Unk08 = unk; + + ProjectItemChanged(); + } + } + + private void Unk09UpDown_ValueChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitter?.AudioEmitter == null) return; + + byte unk = (byte)Unk09UpDown.Value; + if (CurrentEmitter.AudioEmitter.Unk09.Value != unk) + { + CurrentEmitter.AudioEmitter.Unk09 = unk; + + ProjectItemChanged(); + } + } + + private void Unk10UpDown_ValueChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitter?.AudioEmitter == null) return; + + byte unk = (byte)Unk10UpDown.Value; + if (CurrentEmitter.AudioEmitter.Unk10.Value != unk) + { + CurrentEmitter.AudioEmitter.Unk10 = unk; + + ProjectItemChanged(); + } + } + + private void Unk11UpDown_ValueChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitter?.AudioEmitter == null) return; + + byte unk = (byte)Unk11UpDown.Value; + if (CurrentEmitter.AudioEmitter.Unk11.Value != unk) + { + CurrentEmitter.AudioEmitter.Unk11 = unk; + + ProjectItemChanged(); + } + } + + private void Unk12UpDown_ValueChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitter?.AudioEmitter == null) return; + + byte unk = (byte)Unk12UpDown.Value; + if (CurrentEmitter.AudioEmitter.Unk12.Value != unk) + { + CurrentEmitter.AudioEmitter.Unk12 = unk; + + ProjectItemChanged(); + } + } + + private void Unk13UpDown_ValueChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitter?.AudioEmitter == null) return; + + byte unk = (byte)Unk13UpDown.Value; + if (CurrentEmitter.AudioEmitter.Unk13.Value != unk) + { + CurrentEmitter.AudioEmitter.Unk13 = unk; + + ProjectItemChanged(); + } + } + + private void Flags0TextBox_TextChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitter?.AudioEmitter == null) return; + + uint flags = 0; + if (uint.TryParse(Flags0TextBox.Text, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out flags)) + { + if (CurrentEmitter.AudioEmitter.Flags0.Value != flags) + { + CurrentEmitter.AudioEmitter.Flags0 = flags; + + ProjectItemChanged(); + } + } + } + + private void Flags1TextBox_TextChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitter?.AudioEmitter == null) return; + + uint flags = 0; + if (uint.TryParse(Flags1TextBox.Text, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out flags)) + { + if (CurrentEmitter.AudioEmitter.Flags1.Value != flags) + { + CurrentEmitter.AudioEmitter.Flags1 = flags; + + ProjectItemChanged(); + } + } + } + + private void Flags2TextBox_TextChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitter?.AudioEmitter == null) return; + + uint flags = 0; + if (uint.TryParse(Flags2TextBox.Text, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out flags)) + { + if (CurrentEmitter.AudioEmitter.Flags2.Value != flags) + { + CurrentEmitter.AudioEmitter.Flags2 = flags; + + ProjectItemChanged(); + } + } + } + + private void Flags3TextBox_TextChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitter?.AudioEmitter == null) return; + + uint flags = 0; + if (uint.TryParse(Flags3TextBox.Text, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out flags)) + { + if (CurrentEmitter.AudioEmitter.Flags3.Value != flags) + { + CurrentEmitter.AudioEmitter.Flags3 = flags; + + ProjectItemChanged(); + } + } + } + + private void Flags4TextBox_TextChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitter?.AudioEmitter == null) return; + + uint flags = 0; + if (uint.TryParse(Flags4TextBox.Text, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out flags)) + { + if (CurrentEmitter.AudioEmitter.Flags4.Value != flags) + { + CurrentEmitter.AudioEmitter.Flags4 = flags; + + ProjectItemChanged(); + } + } + } + + private void Flags5TextBox_TextChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitter?.AudioEmitter == null) return; + + uint flags = 0; + if (uint.TryParse(Flags5TextBox.Text, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out flags)) + { + if (CurrentEmitter.AudioEmitter.Flags5.Value != flags) + { + CurrentEmitter.AudioEmitter.Flags5 = flags; + + ProjectItemChanged(); + } + } + } + + private void ExtParamsTextBox_TextChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentEmitter?.AudioEmitter == null) return; + + var paramstrs = ExtParamsTextBox.Text.Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); + if (paramstrs?.Length > 0) + { + var paramlist = new List(); + foreach (var paramstr in paramstrs) + { + var paramvals = paramstr.Split(','); + if (paramvals?.Length == 3) + { + var param = new Dat151AmbientEmitter.ExtParam(); + var hashstr = paramvals[0].Trim(); + var valstr = paramvals[1].Trim(); + var flgstr = paramvals[2].Trim(); + uint hash = 0; + if (!uint.TryParse(hashstr, out hash))//don't re-hash hashes + { + hash = JenkHash.GenHash(hashstr); + JenkIndex.Ensure(hashstr); + } + uint flags = 0; + uint.TryParse(flgstr, out flags); + param.Hash = hash; + param.Value = FloatUtil.Parse(valstr); + param.Flags = flags; + paramlist.Add(param); + } + } + + CurrentEmitter.AudioEmitter.ExtParams = paramlist.ToArray(); + CurrentEmitter.AudioEmitter.ExtParamCount = (ushort)paramlist.Count; + + ProjectItemChanged(); + } + } + + private void GoToButton_Click(object sender, EventArgs e) + { + if (CurrentEmitter == null) return; + if (ProjectForm.WorldForm == null) return; + ProjectForm.WorldForm.GoToPosition(CurrentEmitter.Position, CurrentEmitter.AudioZone.InnerSize); + } + + private void AddToProjectButton_Click(object sender, EventArgs e) + { + ProjectForm.SetProjectItem(CurrentEmitter); + ProjectForm.AddAudioFileToProject(CurrentEmitter.RelFile); + } + + private void DeleteButton_Click(object sender, EventArgs e) + { + ProjectForm.SetProjectItem(CurrentEmitter); + ProjectForm.DeleteAudioEmitter(); + } + } } diff --git a/Project/Panels/EditAudioFilePanel.Designer.cs b/Project/Panels/EditAudioFilePanel.Designer.cs index fef616e..7d9934a 100644 --- a/Project/Panels/EditAudioFilePanel.Designer.cs +++ b/Project/Panels/EditAudioFilePanel.Designer.cs @@ -29,20 +29,137 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditAudioFilePanel)); + this.ProjectPathTextBox = new System.Windows.Forms.TextBox(); + this.label30 = new System.Windows.Forms.Label(); + this.FileLocationTextBox = new System.Windows.Forms.TextBox(); + this.label29 = new System.Windows.Forms.Label(); + this.UnkVersionUpDown = new System.Windows.Forms.NumericUpDown(); + this.label6 = new System.Windows.Forms.Label(); + this.FileTypeComboBox = new System.Windows.Forms.ComboBox(); + this.label23 = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.UnkVersionUpDown)).BeginInit(); this.SuspendLayout(); // + // ProjectPathTextBox + // + this.ProjectPathTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.ProjectPathTextBox.Location = new System.Drawing.Point(93, 127); + this.ProjectPathTextBox.Name = "ProjectPathTextBox"; + this.ProjectPathTextBox.ReadOnly = true; + this.ProjectPathTextBox.Size = new System.Drawing.Size(414, 20); + this.ProjectPathTextBox.TabIndex = 66; + // + // label30 + // + this.label30.AutoSize = true; + this.label30.Location = new System.Drawing.Point(14, 130); + this.label30.Name = "label30"; + this.label30.Size = new System.Drawing.Size(67, 13); + this.label30.TabIndex = 65; + this.label30.Text = "Project path:"; + // + // FileLocationTextBox + // + this.FileLocationTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.FileLocationTextBox.Location = new System.Drawing.Point(93, 101); + this.FileLocationTextBox.Name = "FileLocationTextBox"; + this.FileLocationTextBox.ReadOnly = true; + this.FileLocationTextBox.Size = new System.Drawing.Size(414, 20); + this.FileLocationTextBox.TabIndex = 64; + // + // label29 + // + this.label29.AutoSize = true; + this.label29.Location = new System.Drawing.Point(14, 104); + this.label29.Name = "label29"; + this.label29.Size = new System.Drawing.Size(66, 13); + this.label29.TabIndex = 63; + this.label29.Text = "File location:"; + // + // UnkVersionUpDown + // + this.UnkVersionUpDown.Location = new System.Drawing.Point(93, 54); + this.UnkVersionUpDown.Maximum = new decimal(new int[] { + -1, + 0, + 0, + 0}); + this.UnkVersionUpDown.Name = "UnkVersionUpDown"; + this.UnkVersionUpDown.Size = new System.Drawing.Size(124, 20); + this.UnkVersionUpDown.TabIndex = 68; + this.UnkVersionUpDown.ValueChanged += new System.EventHandler(this.UnkVersionUpDown_ValueChanged); + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(14, 56); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(67, 13); + this.label6.TabIndex = 67; + this.label6.Text = "Unk version:"; + // + // FileTypeComboBox + // + this.FileTypeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.FileTypeComboBox.FormattingEnabled = true; + this.FileTypeComboBox.Items.AddRange(new object[] { + "Dat4", + "Dat10ModularSynth", + "Dat15DynamicMixer", + "Dat16Curves", + "Dat22Categories", + "Dat54DataEntries", + "Dat149", + "Dat150", + "Dat151"}); + this.FileTypeComboBox.Location = new System.Drawing.Point(93, 27); + this.FileTypeComboBox.Name = "FileTypeComboBox"; + this.FileTypeComboBox.Size = new System.Drawing.Size(151, 21); + this.FileTypeComboBox.TabIndex = 70; + this.FileTypeComboBox.SelectedIndexChanged += new System.EventHandler(this.FileTypeComboBox_SelectedIndexChanged); + // + // label23 + // + this.label23.AutoSize = true; + this.label23.Location = new System.Drawing.Point(16, 30); + this.label23.Name = "label23"; + this.label23.Size = new System.Drawing.Size(49, 13); + this.label23.TabIndex = 69; + this.label23.Text = "File type:"; + // // EditAudioFilePanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(562, 450); + this.Controls.Add(this.FileTypeComboBox); + this.Controls.Add(this.label23); + this.Controls.Add(this.UnkVersionUpDown); + this.Controls.Add(this.label6); + this.Controls.Add(this.ProjectPathTextBox); + this.Controls.Add(this.label30); + this.Controls.Add(this.FileLocationTextBox); + this.Controls.Add(this.label29); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "EditAudioFilePanel"; this.Text = "Edit Audio File"; + ((System.ComponentModel.ISupportInitialize)(this.UnkVersionUpDown)).EndInit(); this.ResumeLayout(false); + this.PerformLayout(); } #endregion + + private System.Windows.Forms.TextBox ProjectPathTextBox; + private System.Windows.Forms.Label label30; + private System.Windows.Forms.TextBox FileLocationTextBox; + private System.Windows.Forms.Label label29; + private System.Windows.Forms.NumericUpDown UnkVersionUpDown; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.ComboBox FileTypeComboBox; + private System.Windows.Forms.Label label23; } } \ No newline at end of file diff --git a/Project/Panels/EditAudioFilePanel.cs b/Project/Panels/EditAudioFilePanel.cs index cf48386..58fcb47 100644 --- a/Project/Panels/EditAudioFilePanel.cs +++ b/Project/Panels/EditAudioFilePanel.cs @@ -16,6 +16,9 @@ namespace CodeWalker.Project.Panels public ProjectForm ProjectForm; public RelFile CurrentFile { get; set; } + private bool populatingui = false; + + public EditAudioFilePanel(ProjectForm owner) { ProjectForm = owner; @@ -27,6 +30,7 @@ namespace CodeWalker.Project.Panels CurrentFile = file; Tag = file; UpdateFormTitle(); + UpdateUI(); } private void UpdateFormTitle() @@ -34,5 +38,66 @@ namespace CodeWalker.Project.Panels Text = CurrentFile?.Name ?? ""; } + private void UpdateUI() + { + if (CurrentFile == null) + { + populatingui = true; + FileTypeComboBox.Text = string.Empty; + UnkVersionUpDown.Value = 0; + FileLocationTextBox.Text = string.Empty; + ProjectPathTextBox.Text = string.Empty; + populatingui = false; + } + else + { + populatingui = true; + FileTypeComboBox.Text = CurrentFile.RelType.ToString(); + UnkVersionUpDown.Value = CurrentFile.DataUnkVal; + var project = ProjectForm?.CurrentProjectFile; + FileLocationTextBox.Text = CurrentFile.RpfFileEntry?.Path ?? CurrentFile.FilePath; + ProjectPathTextBox.Text = (project != null) ? project.GetRelativePath(CurrentFile.FilePath) : CurrentFile.FilePath; + populatingui = false; + } + } + + private void ProjectItemChanged() + { + if (CurrentFile != null) + { + ProjectForm.SetAudioFileHasChanged(true); + } + } + + private void FileTypeComboBox_SelectedIndexChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentFile == null) return; + + var type = RelDatFileType.Dat151; + if (Enum.TryParse(FileTypeComboBox.Text, out type)) + { + if (CurrentFile.RelType != type) + { + CurrentFile.RelType = type; + + ProjectItemChanged(); + } + } + } + + private void UnkVersionUpDown_ValueChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentFile == null) return; + + byte unk = (byte)UnkVersionUpDown.Value; + if (CurrentFile.DataUnkVal != unk) + { + CurrentFile.DataUnkVal = unk; + + ProjectItemChanged(); + } + } } } diff --git a/Project/Panels/EditAudioZoneListPanel.Designer.cs b/Project/Panels/EditAudioZoneListPanel.Designer.cs index 826ca65..f16ce1b 100644 --- a/Project/Panels/EditAudioZoneListPanel.Designer.cs +++ b/Project/Panels/EditAudioZoneListPanel.Designer.cs @@ -31,6 +31,8 @@ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditAudioZoneListPanel)); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); + this.label12 = new System.Windows.Forms.Label(); + this.NameTextBox = new System.Windows.Forms.TextBox(); this.label19 = new System.Windows.Forms.Label(); this.HashesTextBox = new CodeWalker.WinForms.TextBoxFix(); this.tabControl1.SuspendLayout(); @@ -51,6 +53,8 @@ // // tabPage1 // + this.tabPage1.Controls.Add(this.label12); + this.tabPage1.Controls.Add(this.NameTextBox); this.tabPage1.Controls.Add(this.label19); this.tabPage1.Controls.Add(this.HashesTextBox); this.tabPage1.Location = new System.Drawing.Point(4, 22); @@ -61,14 +65,32 @@ this.tabPage1.Text = "Ambient Zone List"; this.tabPage1.UseVisualStyleBackColor = true; // + // label12 + // + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(26, 9); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(64, 13); + this.label12.TabIndex = 3; + this.label12.Text = "Name hash:"; + // + // NameTextBox + // + this.NameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.NameTextBox.Location = new System.Drawing.Point(103, 6); + this.NameTextBox.Name = "NameTextBox"; + this.NameTextBox.Size = new System.Drawing.Size(428, 20); + this.NameTextBox.TabIndex = 4; + this.NameTextBox.TextChanged += new System.EventHandler(this.NameTextBox_TextChanged); + // // label19 // - this.label19.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.label19.AutoSize = true; - this.label19.Location = new System.Drawing.Point(11, 11); + this.label19.Location = new System.Drawing.Point(18, 35); this.label19.Name = "label19"; this.label19.Size = new System.Drawing.Size(72, 13); - this.label19.TabIndex = 72; + this.label19.TabIndex = 5; this.label19.Text = "Zone hashes:"; // // HashesTextBox @@ -76,12 +98,12 @@ this.HashesTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.HashesTextBox.Location = new System.Drawing.Point(6, 28); + this.HashesTextBox.Location = new System.Drawing.Point(103, 32); this.HashesTextBox.Multiline = true; this.HashesTextBox.Name = "HashesTextBox"; this.HashesTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.HashesTextBox.Size = new System.Drawing.Size(428, 330); - this.HashesTextBox.TabIndex = 73; + this.HashesTextBox.TabIndex = 6; this.HashesTextBox.WordWrap = false; this.HashesTextBox.TextChanged += new System.EventHandler(this.HashesTextBox_TextChanged); // @@ -107,5 +129,7 @@ private System.Windows.Forms.TabPage tabPage1; private System.Windows.Forms.Label label19; private WinForms.TextBoxFix HashesTextBox; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.TextBox NameTextBox; } } \ No newline at end of file diff --git a/Project/Panels/EditAudioZoneListPanel.cs b/Project/Panels/EditAudioZoneListPanel.cs index 3ff8828..43aeeb8 100644 --- a/Project/Panels/EditAudioZoneListPanel.cs +++ b/Project/Panels/EditAudioZoneListPanel.cs @@ -47,6 +47,7 @@ namespace CodeWalker.Project.Panels //DeleteButton.Enabled = false; populatingui = true; + NameTextBox.Text = string.Empty; HashesTextBox.Text = string.Empty; populatingui = false; } @@ -58,6 +59,8 @@ namespace CodeWalker.Project.Panels populatingui = true; var zl = CurrentZoneList; + NameTextBox.Text = zl.NameHash.ToString(); + StringBuilder sb = new StringBuilder(); if (zl.ZoneHashes != null) { @@ -87,6 +90,30 @@ namespace CodeWalker.Project.Panels + private void NameTextBox_TextChanged(object sender, EventArgs e) + { + if (populatingui) return; + if (CurrentZoneList == null) return; + + uint hash = 0; + string name = NameTextBox.Text; + if (!uint.TryParse(name, out hash))//don't re-hash hashes + { + hash = JenkHash.GenHash(name); + JenkIndex.Ensure(name); + } + //NameHashLabel.Text = "Hash: " + hash.ToString(); + + if (CurrentZoneList.NameHash != hash) + { + CurrentZoneList.Name = NameTextBox.Text; + CurrentZoneList.NameHash = hash; + + ProjectItemChanged(); + UpdateFormTitle(); + } + } + private void HashesTextBox_TextChanged(object sender, EventArgs e) { if (populatingui) return; diff --git a/Project/Panels/EditAudioZonePanel.Designer.cs b/Project/Panels/EditAudioZonePanel.Designer.cs index d00308e..778d243 100644 --- a/Project/Panels/EditAudioZonePanel.Designer.cs +++ b/Project/Panels/EditAudioZonePanel.Designer.cs @@ -31,6 +31,8 @@ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditAudioZonePanel)); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tabPage1 = new System.Windows.Forms.TabPage(); + this.label22 = new System.Windows.Forms.Label(); + this.UnkBytesTextBox = new System.Windows.Forms.TextBox(); this.DeleteButton = new System.Windows.Forms.Button(); this.AddToProjectButton = new System.Windows.Forms.Button(); this.label21 = new System.Windows.Forms.Label(); @@ -78,8 +80,6 @@ this.label16 = new System.Windows.Forms.Label(); this.InnerPosTextBox = new System.Windows.Forms.TextBox(); this.GoToButton = new System.Windows.Forms.Button(); - this.label22 = new System.Windows.Forms.Label(); - this.UnkBytesTextBox = new System.Windows.Forms.TextBox(); this.tabControl1.SuspendLayout(); this.tabPage1.SuspendLayout(); this.SuspendLayout(); @@ -154,13 +154,32 @@ this.tabPage1.Text = "Ambient Zone"; this.tabPage1.UseVisualStyleBackColor = true; // + // label22 + // + this.label22.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.label22.AutoSize = true; + this.label22.Location = new System.Drawing.Point(327, 34); + this.label22.Name = "label22"; + this.label22.Size = new System.Drawing.Size(58, 13); + this.label22.TabIndex = 64; + this.label22.Text = "Unk bytes:"; + // + // UnkBytesTextBox + // + this.UnkBytesTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.UnkBytesTextBox.Location = new System.Drawing.Point(390, 31); + this.UnkBytesTextBox.Name = "UnkBytesTextBox"; + this.UnkBytesTextBox.Size = new System.Drawing.Size(155, 20); + this.UnkBytesTextBox.TabIndex = 65; + this.UnkBytesTextBox.TextChanged += new System.EventHandler(this.UnkBytesTextBox_TextChanged); + // // DeleteButton // this.DeleteButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.DeleteButton.Location = new System.Drawing.Point(343, 3); this.DeleteButton.Name = "DeleteButton"; this.DeleteButton.Size = new System.Drawing.Size(93, 23); - this.DeleteButton.TabIndex = 75; + this.DeleteButton.TabIndex = 77; this.DeleteButton.Text = "Delete zone"; this.DeleteButton.UseVisualStyleBackColor = true; this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click); @@ -171,7 +190,7 @@ this.AddToProjectButton.Location = new System.Drawing.Point(452, 3); this.AddToProjectButton.Name = "AddToProjectButton"; this.AddToProjectButton.Size = new System.Drawing.Size(93, 23); - this.AddToProjectButton.TabIndex = 74; + this.AddToProjectButton.TabIndex = 76; this.AddToProjectButton.Text = "Add to project"; this.AddToProjectButton.UseVisualStyleBackColor = true; this.AddToProjectButton.Click += new System.EventHandler(this.AddToProjectButton_Click); @@ -183,7 +202,7 @@ this.label21.Location = new System.Drawing.Point(340, 106); this.label21.Name = "label21"; this.label21.Size = new System.Drawing.Size(44, 13); - this.label21.TabIndex = 68; + this.label21.TabIndex = 70; this.label21.Text = "Flags 2:"; // // Flags2TextBox @@ -192,7 +211,7 @@ this.Flags2TextBox.Location = new System.Drawing.Point(390, 103); this.Flags2TextBox.Name = "Flags2TextBox"; this.Flags2TextBox.Size = new System.Drawing.Size(155, 20); - this.Flags2TextBox.TabIndex = 69; + this.Flags2TextBox.TabIndex = 71; this.Flags2TextBox.TextChanged += new System.EventHandler(this.Flags2TextBox_TextChanged); // // label20 @@ -202,7 +221,7 @@ this.label20.Location = new System.Drawing.Point(340, 278); this.label20.Name = "label20"; this.label20.Size = new System.Drawing.Size(193, 13); - this.label20.TabIndex = 72; + this.label20.TabIndex = 74; this.label20.Text = "Ext params: Name (hash), Value (float)"; // // ExtParamsTextBox @@ -213,7 +232,7 @@ this.ExtParamsTextBox.Name = "ExtParamsTextBox"; this.ExtParamsTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.ExtParamsTextBox.Size = new System.Drawing.Size(209, 116); - this.ExtParamsTextBox.TabIndex = 73; + this.ExtParamsTextBox.TabIndex = 75; this.ExtParamsTextBox.WordWrap = false; this.ExtParamsTextBox.TextChanged += new System.EventHandler(this.ExtParamsTextBox_TextChanged); // @@ -224,7 +243,7 @@ this.label19.Location = new System.Drawing.Point(340, 134); this.label19.Name = "label19"; this.label19.Size = new System.Drawing.Size(46, 13); - this.label19.TabIndex = 70; + this.label19.TabIndex = 72; this.label19.Text = "Hashes:"; // // label15 @@ -292,7 +311,7 @@ this.HashesTextBox.Name = "HashesTextBox"; this.HashesTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.HashesTextBox.Size = new System.Drawing.Size(209, 116); - this.HashesTextBox.TabIndex = 71; + this.HashesTextBox.TabIndex = 73; this.HashesTextBox.WordWrap = false; this.HashesTextBox.TextChanged += new System.EventHandler(this.HashesTextBox_TextChanged); // @@ -303,7 +322,7 @@ this.label14.Location = new System.Drawing.Point(340, 82); this.label14.Name = "label14"; this.label14.Size = new System.Drawing.Size(44, 13); - this.label14.TabIndex = 66; + this.label14.TabIndex = 68; this.label14.Text = "Flags 1:"; // // Flags1TextBox @@ -312,7 +331,7 @@ this.Flags1TextBox.Location = new System.Drawing.Point(390, 79); this.Flags1TextBox.Name = "Flags1TextBox"; this.Flags1TextBox.Size = new System.Drawing.Size(155, 20); - this.Flags1TextBox.TabIndex = 67; + this.Flags1TextBox.TabIndex = 69; this.Flags1TextBox.TextChanged += new System.EventHandler(this.Flags1TextBox_TextChanged); // // label13 @@ -322,7 +341,7 @@ this.label13.Location = new System.Drawing.Point(340, 58); this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size(44, 13); - this.label13.TabIndex = 64; + this.label13.TabIndex = 66; this.label13.Text = "Flags 0:"; // // Flags0TextBox @@ -331,7 +350,7 @@ this.Flags0TextBox.Location = new System.Drawing.Point(390, 55); this.Flags0TextBox.Name = "Flags0TextBox"; this.Flags0TextBox.Size = new System.Drawing.Size(155, 20); - this.Flags0TextBox.TabIndex = 65; + this.Flags0TextBox.TabIndex = 67; this.Flags0TextBox.TextChanged += new System.EventHandler(this.Flags0TextBox_TextChanged); // // ShapeComboBox @@ -615,25 +634,6 @@ this.GoToButton.UseVisualStyleBackColor = true; this.GoToButton.Click += new System.EventHandler(this.GoToButton_Click); // - // label22 - // - this.label22.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.label22.AutoSize = true; - this.label22.Location = new System.Drawing.Point(327, 34); - this.label22.Name = "label22"; - this.label22.Size = new System.Drawing.Size(58, 13); - this.label22.TabIndex = 76; - this.label22.Text = "Unk bytes:"; - // - // UnkBytesTextBox - // - this.UnkBytesTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.UnkBytesTextBox.Location = new System.Drawing.Point(390, 31); - this.UnkBytesTextBox.Name = "UnkBytesTextBox"; - this.UnkBytesTextBox.Size = new System.Drawing.Size(155, 20); - this.UnkBytesTextBox.TabIndex = 77; - this.UnkBytesTextBox.TextChanged += new System.EventHandler(this.UnkBytesTextBox_TextChanged); - // // EditAudioZonePanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/Project/Panels/EditAudioZonePanel.cs b/Project/Panels/EditAudioZonePanel.cs index dae06cd..dada2ac 100644 --- a/Project/Panels/EditAudioZonePanel.cs +++ b/Project/Panels/EditAudioZonePanel.cs @@ -171,6 +171,7 @@ namespace CodeWalker.Project.Panels CurrentZone.AudioZone.NameHash = hash; ProjectItemChanged(); + UpdateFormTitle(); } } diff --git a/Project/Panels/ProjectExplorerPanel.cs b/Project/Panels/ProjectExplorerPanel.cs index 4a9ed99..dd09739 100644 --- a/Project/Panels/ProjectExplorerPanel.cs +++ b/Project/Panels/ProjectExplorerPanel.cs @@ -450,22 +450,24 @@ namespace CodeWalker.Project.Panels node.Nodes.Clear(); - TreeNode n; - n = node.Nodes.Add("Edit Zone"); - n.Name = "EditZone"; - n.Tag = rel; //this tag should get updated with the selected zone! - - n = node.Nodes.Add("Edit Emitter"); - n.Name = "EditEmitter"; - n.Tag = rel; //this tag should get updated with the selected emitter! - + if (rel.RelDatasSorted == null) return; //nothing to see here + var zones = new List(); + var emitters = new List(); var zonelists = new List(); var emitterlists = new List(); - foreach (var reldata in rel.RelDatas) + foreach (var reldata in rel.RelDatasSorted) { + if (reldata is Dat151AmbientZone) + { + zones.Add(reldata as Dat151AmbientZone); + } + if (reldata is Dat151AmbientEmitter) + { + emitters.Add(reldata as Dat151AmbientEmitter); + } if (reldata is Dat151AmbientZoneList) { zonelists.Add(reldata as Dat151AmbientZoneList); @@ -478,10 +480,41 @@ namespace CodeWalker.Project.Panels + if (zones.Count > 0) + { + var n = node.Nodes.Add("Ambient Zones (" + zones.Count.ToString() + ")"); + n.Name = "AmbientZones"; + n.Tag = rel; + + for (int i = 0; i < zones.Count; i++) + { + var zone = zones[i]; + var tnode = n.Nodes.Add(zone.NameHash.ToString()); + tnode.Tag = zone; + } + } + + + if (emitters.Count > 0) + { + var n = node.Nodes.Add("Ambient Emitters (" + emitters.Count.ToString() + ")"); + n.Name = "AmbientEmitters"; + n.Tag = rel; + + for (int i = 0; i < emitters.Count; i++) + { + var emitter = emitters[i]; + var tnode = n.Nodes.Add(emitter.NameHash.ToString()); + tnode.Tag = emitter; + } + } + + + if (zonelists.Count > 0) { - var zonelistsnode = node.Nodes.Add("Zone Lists (" + zonelists.Count.ToString() + ")"); - zonelistsnode.Name = "ZoneLists"; + var zonelistsnode = node.Nodes.Add("Ambient Zone Lists (" + zonelists.Count.ToString() + ")"); + zonelistsnode.Name = "AmbientZoneLists"; zonelistsnode.Tag = rel; for (int i = 0; i < zonelists.Count; i++) { @@ -493,8 +526,8 @@ namespace CodeWalker.Project.Panels if (emitterlists.Count > 0) { - var emitterlistsnode = node.Nodes.Add("Emitter Lists (" + emitterlists.Count.ToString() + ")"); - emitterlistsnode.Name = "EmitterLists"; + var emitterlistsnode = node.Nodes.Add("Ambient Emitter Lists (" + emitterlists.Count.ToString() + ")"); + emitterlistsnode.Name = "AmbientEmitterLists"; emitterlistsnode.Tag = rel; for (int i = 0; i < emitterlists.Count; i++) { @@ -1019,18 +1052,28 @@ namespace CodeWalker.Project.Panels { if (zone == null) return null; TreeNode relnode = FindAudioRelTreeNode(zone.RelFile); - var zonenode = GetChildTreeNode(relnode, "EditZone"); + var zonenode = GetChildTreeNode(relnode, "AmbientZones"); if (zonenode == null) return null; - zonenode.Tag = zone; + //zonenode.Tag = zone; + for (int i = 0; i < zonenode.Nodes.Count; i++) + { + TreeNode znode = zonenode.Nodes[i]; + if (znode.Tag == zone.AudioZone) return znode; + } return zonenode; } public TreeNode FindAudioEmitterTreeNode(AudioPlacement emitter) { if (emitter == null) return null; TreeNode relnode = FindAudioRelTreeNode(emitter.RelFile); - var zonenode = GetChildTreeNode(relnode, "EditEmitter"); + var zonenode = GetChildTreeNode(relnode, "AmbientEmitters"); if (zonenode == null) return null; - zonenode.Tag = emitter; + //zonenode.Tag = emitter; + for (int i = 0; i < zonenode.Nodes.Count; i++) + { + TreeNode znode = zonenode.Nodes[i]; + if (znode.Tag == emitter.AudioEmitter) return znode; + } return zonenode; } public TreeNode FindAudioZoneListTreeNode(Dat151AmbientZoneList list) @@ -1050,7 +1093,7 @@ namespace CodeWalker.Project.Panels { if (list == null) return null; TreeNode relnode = FindAudioRelTreeNode(list.Rel); - var emitterlistsnode = GetChildTreeNode(relnode, "EmitterLists"); + var emitterlistsnode = GetChildTreeNode(relnode, "AmbientEmitterLists"); if (emitterlistsnode == null) return null; for (int i = 0; i < emitterlistsnode.Nodes.Count; i++) { @@ -1539,6 +1582,42 @@ namespace CodeWalker.Project.Panels tn.Parent.Nodes.Remove(tn); } } + public void RemoveAudioZoneTreeNode(AudioPlacement zone) + { + var tn = FindAudioZoneTreeNode(zone); + if ((tn != null) && (tn.Parent != null)) + { + var zones = new List(); + foreach (var reldata in zone.RelFile.RelDatas) + { + if (reldata is Dat151AmbientZone) + { + zones.Add(reldata as Dat151AmbientZone); + } + } + + tn.Parent.Text = "Ambient Zones (" + zones.Count.ToString() + ")"; + tn.Parent.Nodes.Remove(tn); + } + } + public void RemoveAudioEmitterTreeNode(AudioPlacement emitter) + { + var tn = FindAudioEmitterTreeNode(emitter); + if ((tn != null) && (tn.Parent != null)) + { + var emitters = new List(); + foreach (var reldata in emitter.RelFile.RelDatas) + { + if (reldata is Dat151AmbientEmitter) + { + emitters.Add(reldata as Dat151AmbientEmitter); + } + } + + tn.Parent.Text = "Ambient Emitters (" + emitters.Count.ToString() + ")"; + tn.Parent.Nodes.Remove(tn); + } + } public void RemoveAudioZoneListTreeNode(Dat151AmbientZoneList list) { var tn = FindAudioZoneListTreeNode(list); @@ -1553,7 +1632,7 @@ namespace CodeWalker.Project.Panels } } - tn.Parent.Text = "Zone Lists (" + zonelists.Count.ToString() + ")"; + tn.Parent.Text = "Ambient Zone Lists (" + zonelists.Count.ToString() + ")"; tn.Parent.Nodes.Remove(tn); } } @@ -1571,7 +1650,7 @@ namespace CodeWalker.Project.Panels } } - tn.Parent.Text = "Emitter Lists (" + emitterlists.Count.ToString() + ")"; + tn.Parent.Text = "Ambient Emitter Lists (" + emitterlists.Count.ToString() + ")"; tn.Parent.Nodes.Remove(tn); } } diff --git a/Project/ProjectForm.cs b/Project/ProjectForm.cs index dd06f32..c744b53 100644 --- a/Project/ProjectForm.cs +++ b/Project/ProjectForm.cs @@ -463,14 +463,14 @@ namespace CodeWalker.Project ShowPanel(promote, () => { return new EditAudioZonePanel(this); }, //createFunc (panel) => { panel.SetZone(CurrentAudioZone); }, //updateFunc - (panel) => { return panel.CurrentZone == CurrentAudioZone; }); //findFunc + (panel) => { return panel.CurrentZone?.AudioZone == CurrentAudioZone?.AudioZone; }); //findFunc } public void ShowEditAudioEmitterPanel(bool promote) { ShowPanel(promote, () => { return new EditAudioEmitterPanel(this); }, //createFunc (panel) => { panel.SetEmitter(CurrentAudioEmitter); }, //updateFunc - (panel) => { return panel.CurrentEmitter == CurrentAudioEmitter; }); //findFunc + (panel) => { return panel.CurrentEmitter?.AudioEmitter == CurrentAudioEmitter?.AudioEmitter; }); //findFunc } public void ShowEditAudioZoneListPanel(bool promote) { @@ -621,12 +621,23 @@ namespace CodeWalker.Project CurrentScenarioNode = item as ScenarioNode; CurrentScenarioChainEdge = item as MCScenarioChainingEdge; CurrentAudioFile = item as RelFile; - CurrentAudioZone = item as AudioPlacement; if (CurrentAudioZone?.AudioZone == null) CurrentAudioZone = null; - CurrentAudioEmitter = item as AudioPlacement; if (CurrentAudioEmitter?.AudioEmitter == null) CurrentAudioEmitter = null; + CurrentAudioZone = item as AudioPlacement; + CurrentAudioEmitter = item as AudioPlacement; CurrentAudioZoneList = item as Dat151AmbientZoneList; CurrentAudioEmitterList = item as Dat151AmbientEmitterList; CurrentMloRoom = item as MCMloRoomDef; + if (CurrentAudioZone?.AudioZone == null) CurrentAudioZone = null; + if (CurrentAudioEmitter?.AudioEmitter == null) CurrentAudioEmitter = null; + + //need to create a temporary AudioPlacement wrapper for these, since AudioPlacements usually come from WorldForm + var daz = item as Dat151AmbientZone; + var dae = item as Dat151AmbientEmitter; + if (daz != null) CurrentAudioZone = new AudioPlacement(daz.Rel, daz); + if (dae != null) CurrentAudioEmitter = new AudioPlacement(dae.Rel, dae); + + + if (CurrentMloEntity != null) { MloInstanceData instance = TryGetMloInstance(CurrentMloEntity.Archetype); @@ -4370,7 +4381,8 @@ namespace CodeWalker.Project RelFile rel = CurrentProjectFile.AddAudioRelFile(fname); if (rel != null) { - //init stuff.. //TODO + rel.RelType = RelDatFileType.Dat151; //TODO: different types + } } @@ -4523,15 +4535,9 @@ namespace CodeWalker.Project copy = CurrentAudioZone; } + bool cp = copyPosition && (copy != null); var zone = new Dat151AmbientZone(CurrentAudioFile); - var ap = new AudioPlacement(CurrentAudioFile, zone); - - bool cp = copyPosition && (copy != null); - Vector3 pos = cp ? copy.Position : GetSpawnPos(20.0f); - Quaternion ori = cp ? copy.Orientation : Quaternion.Identity; - ap.SetPosition(pos); - ap.SetOrientation(ori); //AA800424 box, line //AA800420 sphere @@ -4552,8 +4558,8 @@ namespace CodeWalker.Project zone.UnkVec1 = cp ? copy.AudioZone.UnkVec1 : new Vector4(0, 0, 1, 0); zone.UnkVec2 = cp ? copy.AudioZone.UnkVec2 : new Vector4(1, -1, -1, 0); zone.UnkVec3 = cp ? copy.AudioZone.UnkVec3 : new Vector4(0, 0, -1, 0); - zone.Unk14 = cp ? copy.AudioZone.Unk14 : (byte)0; - zone.Unk15 = cp ? copy.AudioZone.Unk15 : (byte)0; + zone.Unk14 = cp ? copy.AudioZone.Unk14 : (byte)4; + zone.Unk15 = cp ? copy.AudioZone.Unk15 : (byte)1; zone.Unk16 = cp ? copy.AudioZone.Unk16 : (byte)0; zone.HashesCount = cp ? copy.AudioZone.HashesCount: (byte)0; zone.Hashes = cp ? copy.AudioZone.Hashes : null; @@ -4561,9 +4567,15 @@ namespace CodeWalker.Project zone.ExtParams = cp ? copy.AudioZone.ExtParams : null; zone.Name = "zone1"; zone.NameHash = JenkHash.GenHash(zone.Name); + + var ap = new AudioPlacement(CurrentAudioFile, zone); ap.Name = zone.Name; ap.NameHash = zone.NameHash; + Vector3 pos = cp ? copy.Position : GetSpawnPos(20.0f); + Quaternion ori = cp ? copy.Orientation : Quaternion.Identity; + ap.SetPosition(pos); + ap.SetOrientation(ori); CurrentAudioFile.AddRelData(zone); @@ -4616,20 +4628,20 @@ namespace CodeWalker.Project var delzone = CurrentAudioZone; var delrel = CurrentAudioFile; - //ProjectExplorer?.RemoveAudioZoneTreeNode(delzone); + ProjectExplorer?.RemoveAudioZoneTreeNode(delzone); ProjectExplorer?.SetAudioRelHasChanged(delrel, true); - ClosePanel((EditAudioZonePanel p) => { return p.Tag == delzone; }); + ClosePanel((EditAudioZonePanel p) => { return p.CurrentZone.AudioZone == delzone.AudioZone; }); CurrentAudioZone = null; - if (WorldForm != null) - { - lock (WorldForm.RenderSyncRoot) - { - WorldForm.SelectItem(null); - } - } + //if (WorldForm != null) + //{ + // lock (WorldForm.RenderSyncRoot) + // { + // WorldForm.SelectItem(null); + // } + //} return true; } @@ -4638,9 +4650,65 @@ namespace CodeWalker.Project return zone == CurrentAudioZone; } - public void NewAudioEmitter(AudioPlacement copy = null, bool copyPosition = false) //TODO + public void NewAudioEmitter(AudioPlacement copy = null, bool copyPosition = false) { - MessageBox.Show("NewAudioEmitter TODO!"); + if (CurrentAudioFile == null) return; + + if (copy == null) + { + copy = CurrentAudioEmitter; + } + + bool cp = copyPosition && (copy != null); + + var emitter = new Dat151AmbientEmitter(CurrentAudioFile); + + emitter.Flags0 = cp ? copy.AudioEmitter.Flags0 : 0xAA001100; + emitter.Flags5 = cp ? copy.AudioEmitter.Flags5 : 0xFFFFFFFF; + emitter.InnerRad = cp ? copy.AudioEmitter.InnerRad : 0.0f; + emitter.OuterRad = cp ? copy.AudioEmitter.OuterRad : 20.0f; + emitter.Unk01 = cp ? copy.AudioEmitter.Unk01 : 1.0f; + emitter.Unk02 = cp ? copy.AudioEmitter.Unk02 : 0; + emitter.Unk03 = cp ? copy.AudioEmitter.Unk03 : 0; + emitter.Unk04 = cp ? copy.AudioEmitter.Unk04 : 160; + emitter.Unk05 = cp ? copy.AudioEmitter.Unk05 : 5; + emitter.Unk06 = cp ? copy.AudioEmitter.Unk06 : 0; + emitter.Unk07 = cp ? copy.AudioEmitter.Unk07 : 0; + emitter.Unk08 = cp ? copy.AudioEmitter.Unk08 : 0; + emitter.Unk09 = cp ? copy.AudioEmitter.Unk09 : 1; + emitter.Unk10 = cp ? copy.AudioEmitter.Unk10 : 1; + emitter.Unk11 = cp ? copy.AudioEmitter.Unk11 : 1; + emitter.Unk12 = cp ? copy.AudioEmitter.Unk12 : 100; + emitter.Unk13 = cp ? copy.AudioEmitter.Unk13 : 3; + + + emitter.Name = "emitter1"; + emitter.NameHash = JenkHash.GenHash(emitter.Name); + + var ap = new AudioPlacement(CurrentAudioFile, emitter); + ap.Name = emitter.Name; + ap.NameHash = emitter.NameHash; + + Vector3 pos = cp ? copy.Position : GetSpawnPos(20.0f); + Quaternion ori = cp ? copy.Orientation : Quaternion.Identity; + ap.SetPosition(pos); + ap.SetOrientation(ori); + + + CurrentAudioFile.AddRelData(emitter); + + LoadProjectTree(); + + ProjectExplorer?.TrySelectAudioEmitterTreeNode(ap); + CurrentAudioEmitter = ap; + + ShowEditAudioEmitterPanel(false); + + + if (WorldForm != null) + { + WorldForm.UpdateAudioPlacementGraphics(CurrentAudioFile); + } } public bool DeleteAudioEmitter() { @@ -4677,20 +4745,20 @@ namespace CodeWalker.Project var delem = CurrentAudioEmitter; var delrel = CurrentAudioFile; - //ProjectExplorer?.RemoveAudioEmitterTreeNode(delem); + ProjectExplorer?.RemoveAudioEmitterTreeNode(delem); ProjectExplorer?.SetAudioRelHasChanged(delrel, true); - ClosePanel((EditAudioEmitterPanel p) => { return p.Tag == delem; }); - CurrentAudioEmitter = null; - if (WorldForm != null) - { - lock (WorldForm.RenderSyncRoot) - { - WorldForm.SelectItem(null); - } - } + ClosePanel((EditAudioEmitterPanel p) => { return p.CurrentEmitter.AudioEmitter == delem.AudioEmitter; }); + + //if (WorldForm != null) + //{ + // lock (WorldForm.RenderSyncRoot) + // { + // WorldForm.SelectItem(null); + // } + //} return true; } @@ -4699,9 +4767,22 @@ namespace CodeWalker.Project return emitter == CurrentAudioEmitter; } - public void NewAudioZoneList() //TODO + public void NewAudioZoneList() { - MessageBox.Show("NewAudioZoneList TODO!"); + if (CurrentAudioFile == null) return; + + + var zonelist = new Dat151AmbientZoneList(CurrentAudioFile); + + + CurrentAudioFile.AddRelData(zonelist); + + LoadProjectTree(); + + ProjectExplorer?.TrySelectAudioZoneListTreeNode(zonelist); + CurrentAudioZoneList = zonelist; + + ShowEditAudioZonePanel(false); } public bool DeleteAudioZoneList() { @@ -4750,9 +4831,22 @@ namespace CodeWalker.Project return list == CurrentAudioZoneList; } - public void NewAudioEmitterList() //TODO + public void NewAudioEmitterList() { - MessageBox.Show("NewAudioEmitterList TODO!"); + if (CurrentAudioFile == null) return; + + + var emlist = new Dat151AmbientEmitterList(CurrentAudioFile); + + + CurrentAudioFile.AddRelData(emlist); + + LoadProjectTree(); + + ProjectExplorer?.TrySelectAudioEmitterListTreeNode(emlist); + CurrentAudioEmitterList = emlist; + + ShowEditAudioZonePanel(false); } public bool DeleteAudioEmitterList() {