From a107ec2a2fd86cb7b4729d90bbbc027c28d91a0b Mon Sep 17 00:00:00 2001 From: Li Date: Wed, 11 Jan 2023 01:22:45 -0800 Subject: [PATCH] Fully implement editing weapons. --- .gitignore | 4 +- LibW4M/Data/SaveDataEntry.cs | 2 +- .../{Detonation.cs => DetonationType.cs} | 2 +- .../WeaponFactory/ProjectileLaunchType.cs | 2 +- LibW4M/Data/WeaponFactory/WeaponContainer.cs | 181 ++++ LibW4M/Data/WeaponFactory/WeaponData.cs | 153 --- .../{WeaponEntry.cs => WeaponStore.cs} | 22 +- .../Data/WeaponFactory/WeaponsCollective.cs | 73 ++ LibW4M/W4SaveFile.cs | 33 +- LibXom/Data/XomContainer.cs | 7 +- LibXom/Data/XomFile.cs | 29 +- LibXom/Data/XomString.cs | 22 +- LibXom/LibXom.csproj | 4 + LibXom/LibXom.csproj.user | 6 + LibXom/Streams/XomStreamReader.cs | 8 +- LibXom/XomReader.cs | 2 +- SaveGame.xom | 1 + W4Gui/FloatNumericUpDown.cs | 130 +++ W4Gui/IntNumericUpDown.cs | 100 ++ W4Gui/ListWithAddAndDel.Designer.cs | 156 +++ W4Gui/ListWithAddAndDel.cs | 88 ++ W4Gui/ListWithAddAndDel.resx | 60 ++ W4Gui/Main.Designer.cs | 352 +++++++ W4Gui/Main.cs | 114 +++ W4Gui/Main.resx | 63 ++ W4Gui/Program.cs | 17 + .../PublishProfiles/FolderProfile.pubxml | 18 + .../PublishProfiles/FolderProfile.pubxml.user | 10 + W4Gui/Properties/Resources.Designer.cs | 63 ++ W4Gui/Properties/Resources.resx | 120 +++ W4Gui/W4Gui.csproj | 37 + W4Gui/W4Gui.csproj.user | 20 + W4Gui/WeaponsPanel.Designer.cs | 961 ++++++++++++++++++ W4Gui/WeaponsPanel.cs | 153 +++ W4Gui/WeaponsPanel.resx | 81 ++ Worms4Editor.sln | 14 +- Worms4Editor/Program.cs | 31 - Worms4Editor/Worms4Editor.csproj | 14 - 38 files changed, 2914 insertions(+), 239 deletions(-) rename LibW4M/Data/WeaponFactory/{Detonation.cs => DetonationType.cs} (87%) create mode 100644 LibW4M/Data/WeaponFactory/WeaponContainer.cs delete mode 100644 LibW4M/Data/WeaponFactory/WeaponData.cs rename LibW4M/Data/WeaponFactory/{WeaponEntry.cs => WeaponStore.cs} (64%) create mode 100644 LibW4M/Data/WeaponFactory/WeaponsCollective.cs create mode 100644 LibXom/LibXom.csproj.user create mode 120000 SaveGame.xom create mode 100644 W4Gui/FloatNumericUpDown.cs create mode 100644 W4Gui/IntNumericUpDown.cs create mode 100644 W4Gui/ListWithAddAndDel.Designer.cs create mode 100644 W4Gui/ListWithAddAndDel.cs create mode 100644 W4Gui/ListWithAddAndDel.resx create mode 100644 W4Gui/Main.Designer.cs create mode 100644 W4Gui/Main.cs create mode 100644 W4Gui/Main.resx create mode 100644 W4Gui/Program.cs create mode 100644 W4Gui/Properties/PublishProfiles/FolderProfile.pubxml create mode 100644 W4Gui/Properties/PublishProfiles/FolderProfile.pubxml.user create mode 100644 W4Gui/Properties/Resources.Designer.cs create mode 100644 W4Gui/Properties/Resources.resx create mode 100644 W4Gui/W4Gui.csproj create mode 100644 W4Gui/W4Gui.csproj.user create mode 100644 W4Gui/WeaponsPanel.Designer.cs create mode 100644 W4Gui/WeaponsPanel.cs create mode 100644 W4Gui/WeaponsPanel.resx delete mode 100644 Worms4Editor/Program.cs delete mode 100644 Worms4Editor/Worms4Editor.csproj diff --git a/.gitignore b/.gitignore index 3f9ba73..6785973 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ -Worms4Editor/obj/* -Worms4Editor/bin/* LibXom/obj/* LibXom/bin/* LibW4M/obj/* LibW4M/bin/* +W4Gui/obj/* +W4Gui/bin/* .vs/* diff --git a/LibW4M/Data/SaveDataEntry.cs b/LibW4M/Data/SaveDataEntry.cs index 8f2d583..30f6fa7 100644 --- a/LibW4M/Data/SaveDataEntry.cs +++ b/LibW4M/Data/SaveDataEntry.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; namespace LibW4M.Data { - internal abstract class SaveDataEntry + public abstract class SaveDataEntry { internal Guid guid = Guid.NewGuid(); internal W4SaveFile fileBelongs; diff --git a/LibW4M/Data/WeaponFactory/Detonation.cs b/LibW4M/Data/WeaponFactory/DetonationType.cs similarity index 87% rename from LibW4M/Data/WeaponFactory/Detonation.cs rename to LibW4M/Data/WeaponFactory/DetonationType.cs index 9a96c5b..022b30e 100644 --- a/LibW4M/Data/WeaponFactory/Detonation.cs +++ b/LibW4M/Data/WeaponFactory/DetonationType.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace LibW4M.Data.WeaponFactory { - public enum Detonation : int + public enum DetonationType : int { Impact = 0, Fuse = 1, diff --git a/LibW4M/Data/WeaponFactory/ProjectileLaunchType.cs b/LibW4M/Data/WeaponFactory/ProjectileLaunchType.cs index 3b2e5e8..f76acb6 100644 --- a/LibW4M/Data/WeaponFactory/ProjectileLaunchType.cs +++ b/LibW4M/Data/WeaponFactory/ProjectileLaunchType.cs @@ -8,7 +8,7 @@ namespace LibW4M.Data.WeaponFactory { public enum ProjectileLaunchType : int { - AirStrike = 0 + AirStrike = 0, Launched = 1, Thrown = 2 } diff --git a/LibW4M/Data/WeaponFactory/WeaponContainer.cs b/LibW4M/Data/WeaponFactory/WeaponContainer.cs new file mode 100644 index 0000000..d020aec --- /dev/null +++ b/LibW4M/Data/WeaponFactory/WeaponContainer.cs @@ -0,0 +1,181 @@ +using LibXom.Data; +using LibXom.Streams; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static System.Runtime.InteropServices.JavaScript.JSType; + +namespace LibW4M.Data.WeaponFactory +{ + public class WeaponContainer + { + private W4SaveFile saveFile; + public W4SaveFile OriginalSave + { + get + { + return this.saveFile; + } + } + public XomString Name; + public int Type; + public DetonationType DetonationType; + + public bool Homing; + public bool HomingAvoidLand; + public bool EffectedByWind; + public bool FireOnGround; + public bool Poison; + public int RetreatTime; + + public float WormDamageRadius; + public float WormDamageMagnitude; + public float LandDamageRadius; + + public float ProjectileCollisionRadius; + public float Push; + public int FuseTime; + + public XomString[] GraphicalResources; + public XomString[] GraphicalLocators; + + public XomString LaunchFX; + public XomString ArielFX; + public XomString DetonationFX; + + public int PayloadResourceId; + public ProjectileLaunchType ProjectileLaunchType; + public bool ProjectilePowersUp; + public int ProjectileNumClusters; + public float ProjectileMaxPower; + public float ClusterSpread; + public float ClusterMaxSpeed; + internal byte[] serialize() + { + using (MemoryStream ms = new MemoryStream()) + { + using (XomStreamWriter writer = new XomStreamWriter(ms)) + { + writer.Skip(3); + + writer.WriteCompressedInt(this.Name.Id); + writer.WriteInt32(this.Type); + writer.WriteInt32((int)this.DetonationType); + + writer.WriteBool(this.Homing); + writer.WriteBool(this.HomingAvoidLand); + + writer.WriteBool(this.EffectedByWind); + writer.WriteBool(this.FireOnGround); + writer.WriteBool(this.Poison); + + writer.WriteInt32(this.RetreatTime); + + writer.WriteFloat(this.WormDamageRadius); + writer.WriteFloat(this.WormDamageMagnitude); + writer.WriteFloat(this.LandDamageRadius); + writer.WriteFloat(this.ProjectileCollisionRadius); + writer.WriteFloat(this.Push); + + writer.WriteInt32(this.FuseTime); + + // Write Graphical Resources list + int[] graphicalResourceIds = new int[this.GraphicalResources.Length]; + + for (int i = 0; i < graphicalResourceIds.Length; i++) + graphicalResourceIds[i] = this.GraphicalResources[i].Id; + + writer.WriteCompressedIntArray(graphicalResourceIds); + + // Write Graphical Locators list + int[] graphicalLocatorIds = new int[this.GraphicalLocators.Length]; + + for (int i = 0; i < graphicalLocatorIds.Length; i++) + graphicalLocatorIds[i] = this.GraphicalLocators[i].Id; + + writer.WriteCompressedIntArray(graphicalLocatorIds); + + writer.WriteCompressedInt(this.LaunchFX.Id); + writer.WriteCompressedInt(this.ArielFX.Id); + writer.WriteCompressedInt(this.DetonationFX.Id); + + writer.WriteInt32(this.PayloadResourceId); + writer.WriteInt32((int)this.ProjectileLaunchType); + + writer.WriteBool(this.ProjectilePowersUp); + writer.WriteInt32(this.ProjectileNumClusters); + + writer.WriteFloat(this.ProjectileMaxPower); + writer.WriteFloat(this.ClusterSpread); + writer.WriteFloat(this.ClusterMaxSpeed); + + ms.Seek(0x00, SeekOrigin.Begin); + return ms.ToArray(); + } + } + } + internal void deserailize(byte[] data) + { + using (XomStreamReader reader = new XomStreamReader(new MemoryStream(data))) + { + reader.Skip(3); + + this.Name = saveFile.xomFile.GetStringById(reader.ReadCompressedInt()); + this.Type = reader.ReadInt32(); + this.DetonationType = (DetonationType)reader.ReadInt32(); + + this.Homing = reader.ReadBool(); + this.HomingAvoidLand = reader.ReadBool(); + + this.EffectedByWind = reader.ReadBool(); + this.FireOnGround = reader.ReadBool(); + this.Poison = reader.ReadBool(); + + this.RetreatTime = reader.ReadInt32(); + + this.WormDamageRadius = reader.ReadFloat(); + this.WormDamageMagnitude = reader.ReadFloat(); + this.LandDamageRadius = reader.ReadFloat(); + this.ProjectileCollisionRadius = reader.ReadFloat(); + this.Push = reader.ReadFloat(); + + this.FuseTime = reader.ReadInt32(); + + // Read graphical resources list. + int[] graphicalResourceIds = reader.ReadCompressedIntArray(); + + this.GraphicalResources = new XomString[graphicalResourceIds.Length]; + for (int i = 0; i < graphicalResourceIds.Length; i++) + this.GraphicalResources[i] = saveFile.xomFile.GetStringById(graphicalResourceIds[i]); + + // Read graphical locators list. + int[] graphicalLocatorIds = reader.ReadCompressedIntArray(); + + this.GraphicalLocators = new XomString[graphicalLocatorIds.Length]; + for (int i = 0; i < graphicalLocatorIds.Length; i++) + this.GraphicalLocators[i] = saveFile.xomFile.GetStringById(graphicalLocatorIds[i]); + + this.LaunchFX = saveFile.xomFile.GetStringById(reader.ReadCompressedInt()); + this.ArielFX = saveFile.xomFile.GetStringById(reader.ReadCompressedInt()); + this.DetonationFX = saveFile.xomFile.GetStringById(reader.ReadCompressedInt()); + + this.PayloadResourceId = reader.ReadInt32(); + this.ProjectileLaunchType = (ProjectileLaunchType)reader.ReadInt32(); + + this.ProjectilePowersUp = reader.ReadBool(); + this.ProjectileNumClusters = reader.ReadInt32(); + + this.ProjectileMaxPower = reader.ReadFloat(); + this.ClusterSpread = reader.ReadFloat(); + this.ClusterMaxSpeed = reader.ReadFloat(); + } + } + internal WeaponContainer(byte[] data, W4SaveFile saveFile) + { + this.saveFile = saveFile; + this.deserailize(data); + } + } +} diff --git a/LibW4M/Data/WeaponFactory/WeaponData.cs b/LibW4M/Data/WeaponFactory/WeaponData.cs deleted file mode 100644 index 7b09c87..0000000 --- a/LibW4M/Data/WeaponFactory/WeaponData.cs +++ /dev/null @@ -1,153 +0,0 @@ -using LibXom.Data; -using LibXom.Streams; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using static System.Runtime.InteropServices.JavaScript.JSType; - -namespace LibW4M.Data.WeaponFactory -{ - internal class WeaponData - { - private XomFile saveFile; - - private XomString WeaponName; - public int Type; - public Detonation DetonationType; - - public bool Homing; - public bool HomingAvoidLand; - public bool EffectedByWind; - public bool FireOnGround; - public bool Poison; - public int RetreatTime; - - public float WormDamageRadius; - public float WormDamageMagnitude; - public float LandDamageRadius; - - public float ProjectileCollisionRadius; - public float Push; - public int FuseTime; - - public int[] GraphicalResourceIds; - public int[] GraphicalLocatorIds; - - public XomString LaunchFX; - public XomString ArielFX; - public XomString DetonationFX; - - public int PayloadResourceId; - public ProjectileLaunchType ProjectileLaunchType; - public bool ProjectilePowersUp; - public int ProjectileNumClusters; - public float ProjectileMaxPower; - public float ClusterSpread; - public float ClusterMaxSpeed; - internal byte[] serialize() - { - using (XomStreamWriter writer = new XomStreamWriter(new MemoryStream())) - { - writer.Skip(3); - - writer.WriteCompressedInt(this.WeaponName.Id); - writer.WriteInt32(this.Type); - writer.WriteInt32((int)this.DetonationType); - - writer.WriteBool(this.Homing); - writer.WriteBool(this.HomingAvoidLand); - - writer.WriteBool(this.EffectedByWind); - writer.WriteBool(this.FireOnGround); - writer.WriteBool(this.Poison); - - writer.WriteInt32(this.RetreatTime); - - writer.WriteFloat(this.WormDamageRadius); - writer.WriteFloat(this.WormDamageMagnitude); - writer.WriteFloat(this.LandDamageRadius); - writer.WriteFloat(this.ProjectileCollisionRadius); - writer.WriteFloat(this.Push); - - writer.WriteInt32(this.FuseTime); - - writer.WriteCompressedIntArray(this.GraphicalResourceIds); - writer.WriteCompressedIntArray(this.GraphicalLocatorIds); - - writer.WriteCompressedInt(this.LaunchFX.Id); - writer.WriteCompressedInt(this.ArielFX.Id); - writer.WriteCompressedInt(this.DetonationFX.Id); - - writer.WriteInt32(this.PayloadResourceId); - writer.WriteInt32((int)this.ProjectileLaunchType); - - writer.WriteBool(this.ProjectilePowersUp); - writer.WriteInt32(this.ProjectileNumClusters); - - writer.WriteFloat(this.ProjectileMaxPower); - writer.WriteFloat(this.ClusterSpread); - writer.WriteFloat(this.ClusterMaxSpeed); - - writer.Skip(1); - - writer.BaseStream.Seek(0x00, SeekOrigin.Begin); - MemoryStream ms = (MemoryStream)(writer.BaseStream).ToArray(); - - } - } - internal void deserailize(byte[] data) - { - using (XomStreamReader reader = new XomStreamReader(new MemoryStream(data))) - { - reader.Skip(3); - - this.WeaponName = saveFile.GetStringById(reader.ReadCompressedInt()); - this.Type = reader.ReadInt32(); - this.DetonationType = (Detonation)reader.ReadInt32(); - - this.Homing = reader.ReadBool(); - this.HomingAvoidLand = reader.ReadBool(); - - this.EffectedByWind = reader.ReadBool(); - this.FireOnGround = reader.ReadBool(); - this.Poison = reader.ReadBool(); - - this.RetreatTime = reader.ReadInt32(); - - this.WormDamageRadius = reader.ReadFloat(); - this.WormDamageMagnitude = reader.ReadFloat(); - this.LandDamageRadius = reader.ReadFloat(); - this.ProjectileCollisionRadius = reader.ReadFloat(); - this.Push = reader.ReadFloat(); - - this.FuseTime = reader.ReadInt32(); - - this.GraphicalResourceIds = reader.ReadCompressedIntArray(); - this.GraphicalLocatorIds = reader.ReadCompressedIntArray(); - - this.LaunchFX = saveFile.GetStringById(reader.ReadCompressedInt()); - this.ArielFX = saveFile.GetStringById(reader.ReadCompressedInt()); - this.DetonationFX = saveFile.GetStringById(reader.ReadCompressedInt()); - - this.PayloadResourceId = reader.ReadInt32(); - this.ProjectileLaunchType = (ProjectileLaunchType)reader.ReadInt32(); - - this.ProjectilePowersUp = reader.ReadBool(); - this.ProjectileNumClusters = reader.ReadInt32(); - - this.ProjectileMaxPower = reader.ReadFloat(); - this.ClusterSpread = reader.ReadFloat(); - this.ClusterMaxSpeed = reader.ReadFloat(); - - reader.Skip(1); - } - } - internal WeaponData(byte[] data, XomFile saveFile) - { - this.saveFile = saveFile; - this.deserailize(data); - } - } -} diff --git a/LibW4M/Data/WeaponFactory/WeaponEntry.cs b/LibW4M/Data/WeaponFactory/WeaponStore.cs similarity index 64% rename from LibW4M/Data/WeaponFactory/WeaponEntry.cs rename to LibW4M/Data/WeaponFactory/WeaponStore.cs index 467c257..d22e4cb 100644 --- a/LibW4M/Data/WeaponFactory/WeaponEntry.cs +++ b/LibW4M/Data/WeaponFactory/WeaponStore.cs @@ -9,33 +9,27 @@ using System.Threading.Tasks; namespace LibW4M.Data.WeaponFactory { - internal class WeaponEntry : SaveDataEntry + public class WeaponStore : SaveDataEntry { - public WeaponData Weapon; - public WeaponData Cluster; + public WeaponContainer Weapon; + public WeaponContainer Cluster; - private XomContainer weaponContainer; - private XomContainer clusterContainer; + internal XomContainer weaponContainer; + internal XomContainer clusterContainer; - public WeaponEntry(W4SaveFile fileBelongs, XomContainer mainContainer) : base(fileBelongs, mainContainer) + public WeaponStore(W4SaveFile fileBelongs, XomContainer mainContainer) : base(fileBelongs, mainContainer) { this.Load(); } - - public override void Delete() - { - throw new NotImplementedException(); - } - public override void Load() { int[] weaponStore = this.mainContainer.Decompress(); this.weaponContainer = this.fileBelongs.xomFile.GetContainerById(weaponStore[1]); this.clusterContainer = this.fileBelongs.xomFile.GetContainerById(weaponStore[2]); - this.Weapon = new WeaponData(this.weaponContainer.GetData(), this.fileBelongs.xomFile); - this.Cluster = new WeaponData(this.clusterContainer.GetData(), this.fileBelongs.xomFile); + this.Weapon = new WeaponContainer(this.weaponContainer.GetData(), this.fileBelongs); + this.Cluster = new WeaponContainer(this.clusterContainer.GetData(), this.fileBelongs); } public override void Save() diff --git a/LibW4M/Data/WeaponFactory/WeaponsCollective.cs b/LibW4M/Data/WeaponFactory/WeaponsCollective.cs new file mode 100644 index 0000000..7469c7a --- /dev/null +++ b/LibW4M/Data/WeaponFactory/WeaponsCollective.cs @@ -0,0 +1,73 @@ +using LibXom.Data; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace LibW4M.Data.WeaponFactory +{ + public class WeaponsCollective : SaveDataEntry + { + private List weaponCollective; + + public WeaponStore this[int i] + { + get + { + return weaponCollective[i]; + } + set + { + weaponCollective[i] = value; + } + } + public int Length + { + get + { + return weaponCollective.Count; + } + } + public WeaponsCollective(W4SaveFile fileBelongs, XomContainer mainContainer) : base(fileBelongs, mainContainer) + { + this.weaponCollective = new List(); + this.Load(); + } + + public void Delete(WeaponStore store) + { + for(int i = 0; i < this.Length; i++) + { + WeaponStore weaponStore = this[i]; + if(weaponStore.uuid.Equals(store.uuid, StringComparison.InvariantCultureIgnoreCase)) + { + weaponCollective.RemoveAt(i); + weaponStore.weaponContainer.Delete(); + weaponStore.clusterContainer.Delete(); + weaponStore.mainContainer.Delete(); + break; + } + } + } + + public override void Load() + { + int[] collective = mainContainer.Decompress(); + for (int i = 0; i < collective[0]; i++) weaponCollective.Add(new WeaponStore(this.fileBelongs, this.fileBelongs.xomFile.GetContainerById(collective[i + 1]))); + } + + public override void Save() + { + int[] collective = mainContainer.Decompress(); + collective[0] = weaponCollective.Count; + for (int i = 0; i < weaponCollective.Count; i++) + { + WeaponStore store = weaponCollective[i]; + store.Save(); + collective[i + 1] = store.mainContainer.Id; + } + mainContainer.CompressAndUpdate(collective); + } + } +} diff --git a/LibW4M/W4SaveFile.cs b/LibW4M/W4SaveFile.cs index 15cb2d1..8352f72 100644 --- a/LibW4M/W4SaveFile.cs +++ b/LibW4M/W4SaveFile.cs @@ -1,14 +1,41 @@ -using LibXom.Data; +using LibW4M.Data; +using LibW4M.Data.WeaponFactory; +using LibXom; +using LibXom.Data; namespace LibW4M { public class W4SaveFile { - - public XomFile xomFile; + internal List entries = new List(); + private WeaponsCollective weaponFactoryCollective; + public WeaponsCollective WeaponFactoryCollective + { + get + { + return weaponFactoryCollective; + } + } + internal XomFile xomFile; + public void Save(string newXom) + { + foreach(SaveDataEntry entry in entries) + { + entry.Save(); + } + + XomWriter.WriteXom(xomFile, newXom); + } + public XomString LookupString(string value) + { + return xomFile.AddOrGetString(value); + } public W4SaveFile(XomFile w4Save) { this.xomFile = w4Save; + weaponFactoryCollective = new WeaponsCollective(this, this.xomFile.GetTypeByName("WeaponFactoryCollective").Containers.First()); + + entries.Add(weaponFactoryCollective); } } } \ No newline at end of file diff --git a/LibXom/Data/XomContainer.cs b/LibXom/Data/XomContainer.cs index 5ac5ac5..b9d0314 100644 --- a/LibXom/Data/XomContainer.cs +++ b/LibXom/Data/XomContainer.cs @@ -52,7 +52,7 @@ namespace LibXom.Data { byte[] buffer = XomCompressor.compressBuffer(nums); byte[] compressedData = new byte[buffer.Length + 3]; - Array.ConstrainedCopy(buffer, 0, compressedData, 3, compressedData.Length); + Array.ConstrainedCopy(buffer, 0, compressedData, 3, buffer.Length); return compressedData; } public void CompressAndUpdate(byte[] bytes) @@ -83,6 +83,11 @@ namespace LibXom.Data return intArray; } + public void Delete() + { + this.Type.DeleteContainer(this); + } + private byte[] intArrayToByteArray(int[] intArray) { using (MemoryStream ms = new MemoryStream()) diff --git a/LibXom/Data/XomFile.cs b/LibXom/Data/XomFile.cs index dcc2b3c..a012901 100644 --- a/LibXom/Data/XomFile.cs +++ b/LibXom/Data/XomFile.cs @@ -42,9 +42,30 @@ namespace LibXom.Data return xomContainers.ToArray(); } } - public XomString GetStringById(int stringId) + internal void updateStringById(int stringId, XomString newStr) { - return XomStrings[stringId - 1]; + xomStrings[stringId] = newStr; + } + + public XomString AddOrGetString(string value) + { + XomString[] strings = XomStrings; + for (int i = 0; i < strings.Length; i++) + if (strings[i].Value == value) return strings[i]; + + XomString str = new XomString(this, value); + xomStrings.Add(str); + return str; + } + + public void DeleteString(XomString str) + { + xomStrings.RemoveAt(str.Id); + } + + public XomString GetStringById(int stringId) + { + return XomStrings[stringId]; } public XomContainer GetContainerById(int containerId) { @@ -92,7 +113,7 @@ namespace LibXom.Data XomString str = stringsSorted[i]; stringLst[i] = str.Value; stringOffsets.Add(str.Value, loc); - loc += str.Value.Length + 1; // str length, + \0 for terminator. + loc += str.Length + 1; // str length, + \0 for terminator. } // now create the strs block @@ -139,7 +160,7 @@ namespace LibXom.Data foreach (string str in stringBlock.StringList) { stringOffsets.Add(loc, str); - loc += str.Length + 1; // str length, + \0 for terminator. + loc += Encoding.UTF8.GetByteCount(str) + 1; // str length, + \0 for terminator. } // Now create the list of XomStrings ... diff --git a/LibXom/Data/XomString.cs b/LibXom/Data/XomString.cs index 49c86dc..7dc9f25 100644 --- a/LibXom/Data/XomString.cs +++ b/LibXom/Data/XomString.cs @@ -15,15 +15,33 @@ namespace LibXom.Data { get { - return this.fileBelongs.calculateIdForXomFileComponent(this.uuid, fileBelongs.XomStrings); + return this.fileBelongs.calculateIdForXomFileComponent(this.uuid, fileBelongs.XomStrings) - 1; } } public string Value { get { - return value; + return this.value; } + set + { + this.value = value; + fileBelongs.updateStringById(this.Id, this); + } + } + + public int Length + { + get + { + return Encoding.UTF8.GetByteCount(this.Value); + } + } + + public override string ToString() + { + return this.Value; } internal XomString(XomFile fromFile, string value) { diff --git a/LibXom/LibXom.csproj b/LibXom/LibXom.csproj index a1ed5b3..1775293 100644 --- a/LibXom/LibXom.csproj +++ b/LibXom/LibXom.csproj @@ -6,4 +6,8 @@ enable + + + + diff --git a/LibXom/LibXom.csproj.user b/LibXom/LibXom.csproj.user new file mode 100644 index 0000000..0a2ed7d --- /dev/null +++ b/LibXom/LibXom.csproj.user @@ -0,0 +1,6 @@ + + + + <_LastSelectedProfileId>C:\Users\Li\Documents\git\Worms4Editor\LibXom\Properties\PublishProfiles\FolderProfile.pubxml + + \ No newline at end of file diff --git a/LibXom/Streams/XomStreamReader.cs b/LibXom/Streams/XomStreamReader.cs index 4849ae8..0e16e2c 100644 --- a/LibXom/Streams/XomStreamReader.cs +++ b/LibXom/Streams/XomStreamReader.cs @@ -56,16 +56,16 @@ namespace LibXom.Streams } public string ReadCStr() { - StringBuilder cstr = new StringBuilder(); + List cstr = new List(); while (true) { - char c = (char)ReadByte(); + byte c = ReadByte(); if (c == 0) break; - cstr.Append(c); + cstr.Add(c); } - return cstr.ToString(); + return Encoding.UTF8.GetString(cstr.ToArray()); } public void Skip(int amt) { diff --git a/LibXom/XomReader.cs b/LibXom/XomReader.cs index c7bbbcb..6f5d23a 100644 --- a/LibXom/XomReader.cs +++ b/LibXom/XomReader.cs @@ -98,7 +98,7 @@ namespace LibXom { strings[i] = xomStream.ReadCStr(); } - return new StrsBlock(numStrs, strsSz, offsets, strings); ; + return new StrsBlock(numStrs, strsSz, offsets, strings); } public XomBlock? readBlock() { diff --git a/SaveGame.xom b/SaveGame.xom new file mode 120000 index 0000000..1f2cbdb --- /dev/null +++ b/SaveGame.xom @@ -0,0 +1 @@ +C:/Users/Li/AppData/Local/VirtualStore/Program Files (x86)/Codemasters/Worms 4 Mayhem/Data/SaveGame.xom \ No newline at end of file diff --git a/W4Gui/FloatNumericUpDown.cs b/W4Gui/FloatNumericUpDown.cs new file mode 100644 index 0000000..f73c955 --- /dev/null +++ b/W4Gui/FloatNumericUpDown.cs @@ -0,0 +1,130 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Media; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; + +namespace W4Gui +{ + public class FloatNumericUpDown : UpDownBase + { + private float value = 0; + private bool updating = false; + public float Value + { + get + { + if (this.UserEdit) ValidateEditText(); + return this.value; + } + set + { + this.value = value; + UpdateEditText(); + } + } + public override void DownButton() + { + try + { + this.Value--; + } + catch (OverflowException) { this.Value = Single.MinValue; }; + } + + public override void UpButton() + { + try + { + this.Value++; + } + catch (OverflowException) { this.Value = Single.MaxValue; }; + } + + protected override void OnLostFocus(EventArgs e) + { + base.OnLostFocus(e); + if (UserEdit) + { + UpdateEditText(); + } + } + protected override void UpdateEditText() + { + if (this.updating) return; + + this.updating = true; + if (Single.IsNaN(this.Value)) + { + this.Text = "NaN"; + } + if (Single.IsNegativeInfinity(this.Value)) + { + this.Text = "-Inf"; + } + if (Single.IsPositiveInfinity(this.Value)) + { + this.Text = "+Inf"; + } + else + { + string floatStr = Convert.ToDouble(this.Value).ToString("G9", CultureInfo.InvariantCulture); + if (!floatStr.Contains(".")) + floatStr += ".00"; + this.Text = floatStr; + + } + this.updating = false; + } + + protected override void OnTextBoxKeyPress(object? source, KeyPressEventArgs e) + { + base.OnTextBoxKeyPress(source, e); + + if (Char.IsDigit(e.KeyChar)) return; + else if ("+-.infa\b".Contains(e.KeyChar.ToString().ToLower().First())) return; + else if ((Control.ModifierKeys & (Keys.Control | Keys.Alt)) != 0) return; + + e.Handled = true; + SystemSounds.Beep.Play(); + } + protected override void ValidateEditText() + { + try + { + this.value = Single.Parse(this.Text); + UpdateEditText(); + } + catch (FormatException ex) + { + if (this.Text.Equals("NaN", StringComparison.InvariantCultureIgnoreCase)) + this.value = Single.NaN; + else if (this.Text.Equals("Inf", StringComparison.InvariantCultureIgnoreCase)) + this.value = Single.PositiveInfinity; + else if (this.Text.Equals("+Inf", StringComparison.InvariantCultureIgnoreCase)) + this.value = Single.PositiveInfinity; + else if (this.Text.Equals("-Inf", StringComparison.InvariantCultureIgnoreCase)) + this.value = Single.NegativeInfinity; + UpdateEditText(); + } + catch (OverflowException ex) + { + if (this.Text.StartsWith("-")) this.Value = Single.MinValue; + else this.value = Single.MaxValue; + UpdateEditText(); + } + catch + { + // Leave value alone + } + finally + { + UserEdit = false; + } + } + + } +} diff --git a/W4Gui/IntNumericUpDown.cs b/W4Gui/IntNumericUpDown.cs new file mode 100644 index 0000000..da3437b --- /dev/null +++ b/W4Gui/IntNumericUpDown.cs @@ -0,0 +1,100 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Media; +using System.Text; +using System.Threading.Tasks; + +namespace W4Gui +{ + public class IntNumericUpDown : UpDownBase + { + private int value = 0; + private bool updating = false; + public int Value + { + get + { + if (this.UserEdit) ValidateEditText(); + return this.value; + } + set + { + this.value = value; + UpdateEditText(); + } + } + + public override void DownButton() + { + try + { + this.Value--; + } + catch (OverflowException) { this.Value = Int32.MinValue; }; + } + + public override void UpButton() + { + try + { + this.Value++; + } + catch (Exception) { this.Value = Int32.MaxValue; }; + } + + + protected override void UpdateEditText() + { + if (this.updating) return; + + this.updating = true; + this.Text = this.Value.ToString(); + this.updating = false; + } + + protected override void OnTextBoxKeyPress(object? source, KeyPressEventArgs e) + { + base.OnTextBoxKeyPress(source, e); + + if (Char.IsDigit(e.KeyChar)) return; + else if ("-\b".Contains(e.KeyChar.ToString().ToLower().First())) return; + else if ((Control.ModifierKeys & (Keys.Control | Keys.Alt)) != 0) return; + + e.Handled = true; + SystemSounds.Beep.Play(); + } + + protected override void OnLostFocus(EventArgs e) + { + base.OnLostFocus(e); + if (UserEdit) + { + UpdateEditText(); + } + } + protected override void ValidateEditText() + { + try + { + this.value = Int32.Parse(this.Text); + UpdateEditText(); + } + catch (OverflowException ex) + { + if(this.Text.StartsWith("-")) this.Value = Int32.MinValue; + else this.Value = Int32.MaxValue; + } + catch + { + UpdateEditText(); + } + finally + { + UserEdit = false; + }; + } + + } +} diff --git a/W4Gui/ListWithAddAndDel.Designer.cs b/W4Gui/ListWithAddAndDel.Designer.cs new file mode 100644 index 0000000..3064cf4 --- /dev/null +++ b/W4Gui/ListWithAddAndDel.Designer.cs @@ -0,0 +1,156 @@ +namespace W4Gui +{ + partial class ListWithAddAndDel + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.tableWListAndButtons = new System.Windows.Forms.TableLayoutPanel(); + this.lst = new System.Windows.Forms.ListBox(); + this.addDelButtonDivisor = new System.Windows.Forms.TableLayoutPanel(); + this.updateBtn = new System.Windows.Forms.Button(); + this.delBtn = new System.Windows.Forms.Button(); + this.addBtn = new System.Windows.Forms.Button(); + this.newEntry = new System.Windows.Forms.TextBox(); + this.tableWListAndButtons.SuspendLayout(); + this.addDelButtonDivisor.SuspendLayout(); + this.SuspendLayout(); + // + // tableWListAndButtons + // + this.tableWListAndButtons.ColumnCount = 1; + this.tableWListAndButtons.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableWListAndButtons.Controls.Add(this.lst, 0, 0); + this.tableWListAndButtons.Controls.Add(this.addDelButtonDivisor, 0, 2); + this.tableWListAndButtons.Controls.Add(this.newEntry, 0, 1); + this.tableWListAndButtons.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableWListAndButtons.Location = new System.Drawing.Point(0, 0); + this.tableWListAndButtons.Name = "tableWListAndButtons"; + this.tableWListAndButtons.RowCount = 2; + this.tableWListAndButtons.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableWListAndButtons.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableWListAndButtons.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableWListAndButtons.Size = new System.Drawing.Size(517, 190); + this.tableWListAndButtons.TabIndex = 21; + // + // lst + // + this.lst.Dock = System.Windows.Forms.DockStyle.Fill; + this.lst.FormattingEnabled = true; + this.lst.ItemHeight = 15; + this.lst.Location = new System.Drawing.Point(3, 3); + this.lst.Name = "lst"; + this.lst.ScrollAlwaysVisible = true; + this.lst.Size = new System.Drawing.Size(511, 106); + this.lst.TabIndex = 0; + this.lst.SelectedIndexChanged += new System.EventHandler(this.lst_SelectedIndexChanged); + this.lst.KeyDown += new System.Windows.Forms.KeyEventHandler(this.lst_KeyDown); + // + // addDelButtonDivisor + // + this.addDelButtonDivisor.ColumnCount = 3; + this.addDelButtonDivisor.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); + this.addDelButtonDivisor.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); + this.addDelButtonDivisor.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F)); + this.addDelButtonDivisor.Controls.Add(this.updateBtn, 0, 0); + this.addDelButtonDivisor.Controls.Add(this.delBtn, 2, 0); + this.addDelButtonDivisor.Controls.Add(this.addBtn, 0, 0); + this.addDelButtonDivisor.Dock = System.Windows.Forms.DockStyle.Fill; + this.addDelButtonDivisor.Location = new System.Drawing.Point(3, 144); + this.addDelButtonDivisor.Name = "addDelButtonDivisor"; + this.addDelButtonDivisor.RowCount = 1; + this.addDelButtonDivisor.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.addDelButtonDivisor.Size = new System.Drawing.Size(511, 43); + this.addDelButtonDivisor.TabIndex = 1; + // + // updateBtn + // + this.updateBtn.Dock = System.Windows.Forms.DockStyle.Fill; + this.updateBtn.Location = new System.Drawing.Point(173, 3); + this.updateBtn.Name = "updateBtn"; + this.updateBtn.Size = new System.Drawing.Size(164, 37); + this.updateBtn.TabIndex = 2; + this.updateBtn.Text = "Update"; + this.updateBtn.UseVisualStyleBackColor = true; + this.updateBtn.Click += new System.EventHandler(this.updateBtn_Click); + // + // delBtn + // + this.delBtn.Dock = System.Windows.Forms.DockStyle.Fill; + this.delBtn.Location = new System.Drawing.Point(343, 3); + this.delBtn.Name = "delBtn"; + this.delBtn.Size = new System.Drawing.Size(165, 37); + this.delBtn.TabIndex = 1; + this.delBtn.Text = "Delete"; + this.delBtn.UseVisualStyleBackColor = true; + this.delBtn.Click += new System.EventHandler(this.delBtn_Click); + // + // addBtn + // + this.addBtn.Dock = System.Windows.Forms.DockStyle.Fill; + this.addBtn.Location = new System.Drawing.Point(3, 3); + this.addBtn.Name = "addBtn"; + this.addBtn.Size = new System.Drawing.Size(164, 37); + this.addBtn.TabIndex = 0; + this.addBtn.Text = "Add"; + this.addBtn.UseVisualStyleBackColor = true; + this.addBtn.Click += new System.EventHandler(this.addBtn_Click); + // + // newEntry + // + this.newEntry.Dock = System.Windows.Forms.DockStyle.Fill; + this.newEntry.Location = new System.Drawing.Point(3, 115); + this.newEntry.Name = "newEntry"; + this.newEntry.PlaceholderText = "Enter Text"; + this.newEntry.Size = new System.Drawing.Size(511, 23); + this.newEntry.TabIndex = 4; + this.newEntry.KeyDown += new System.Windows.Forms.KeyEventHandler(this.newEntry_KeyDown); + // + // ListWithAddAndDel + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.tableWListAndButtons); + this.Name = "ListWithAddAndDel"; + this.Size = new System.Drawing.Size(517, 190); + this.tableWListAndButtons.ResumeLayout(false); + this.tableWListAndButtons.PerformLayout(); + this.addDelButtonDivisor.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private TableLayoutPanel tableWListAndButtons; + private ListBox lst; + private TableLayoutPanel addDelButtonDivisor; + private Button delBtn; + private Button addBtn; + private TextBox newEntry; + private Button updateBtn; + } +} diff --git a/W4Gui/ListWithAddAndDel.cs b/W4Gui/ListWithAddAndDel.cs new file mode 100644 index 0000000..4256b78 --- /dev/null +++ b/W4Gui/ListWithAddAndDel.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace W4Gui +{ + public partial class ListWithAddAndDel : UserControl + { + public ListWithAddAndDel() + { + InitializeComponent(); + } + + public string[] Items + { + get + { + int itmCnt = lst.Items.Count; + string[] items = new string[itmCnt]; + for (int i = 0; i < itmCnt; i++) + items[i] = lst.Items[i].ToString(); + + return items; + } + } + public void Clear() + { + lst.Items.Clear(); + } + public void AddItem(string item) + { + if(item.Trim() != "") + lst.Items.Add(item); + } + + private void addBtn_Click(object sender, EventArgs e) + { + string val = newEntry.Text.Trim(); + AddItem(val); + } + + private void delBtn_Click(object sender, EventArgs e) + { + int sel = lst.SelectedIndex; + if (sel >= 0) + lst.Items.RemoveAt(sel); + } + + private void updateBtn_Click(object sender, EventArgs e) + { + int sel = lst.SelectedIndex; + if(sel >= 0) + lst.Items[sel] = newEntry.Text.Trim(); + } + + private void newEntry_KeyDown(object sender, KeyEventArgs e) + { + if(e.KeyData == Keys.Enter) + { + e.Handled = true; + updateBtn_Click(sender, e); + } + } + + private void lst_KeyDown(object sender, KeyEventArgs e) + { + if(e.KeyData == Keys.Delete) + { + e.Handled = true; + delBtn_Click(sender, e); + } + } + + + + private void lst_SelectedIndexChanged(object sender, EventArgs e) + { + if (lst.SelectedIndex >= 0) + newEntry.Text = lst.Items[lst.SelectedIndex].ToString(); + } + } +} diff --git a/W4Gui/ListWithAddAndDel.resx b/W4Gui/ListWithAddAndDel.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/W4Gui/ListWithAddAndDel.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/W4Gui/Main.Designer.cs b/W4Gui/Main.Designer.cs new file mode 100644 index 0000000..74a70b3 --- /dev/null +++ b/W4Gui/Main.Designer.cs @@ -0,0 +1,352 @@ +namespace W4Gui +{ + partial class Main + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.mainMenuStrip = new System.Windows.Forms.MenuStrip(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.mainTabControl = new System.Windows.Forms.TabControl(); + this.weaponsPage = new System.Windows.Forms.TabPage(); + this.weaponSplitContainer = new System.Windows.Forms.SplitContainer(); + this.weaponList = new System.Windows.Forms.ListBox(); + this.weaponClusterTabControl = new System.Windows.Forms.TabControl(); + this.mainWeaponPage = new System.Windows.Forms.TabPage(); + this.weaponPanel = new W4Gui.WeaponsPanel(); + this.clustersPage = new System.Windows.Forms.TabPage(); + this.clusterPanel = new W4Gui.WeaponsPanel(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.label1 = new System.Windows.Forms.Label(); + this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.tableLayoutPanel11 = new System.Windows.Forms.TableLayoutPanel(); + this.label21 = new System.Windows.Forms.Label(); + this.label22 = new System.Windows.Forms.Label(); + this.mainMenuStrip.SuspendLayout(); + this.mainTabControl.SuspendLayout(); + this.weaponsPage.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.weaponSplitContainer)).BeginInit(); + this.weaponSplitContainer.Panel1.SuspendLayout(); + this.weaponSplitContainer.Panel2.SuspendLayout(); + this.weaponSplitContainer.SuspendLayout(); + this.weaponClusterTabControl.SuspendLayout(); + this.mainWeaponPage.SuspendLayout(); + this.clustersPage.SuspendLayout(); + this.tableLayoutPanel1.SuspendLayout(); + this.tableLayoutPanel11.SuspendLayout(); + this.SuspendLayout(); + // + // mainMenuStrip + // + this.mainMenuStrip.BackColor = System.Drawing.SystemColors.Control; + this.mainMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fileToolStripMenuItem}); + this.mainMenuStrip.Location = new System.Drawing.Point(0, 0); + this.mainMenuStrip.Name = "mainMenuStrip"; + this.mainMenuStrip.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional; + this.mainMenuStrip.Size = new System.Drawing.Size(947, 24); + this.mainMenuStrip.TabIndex = 0; + this.mainMenuStrip.Text = "Menu Strip"; + // + // fileToolStripMenuItem + // + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.openToolStripMenuItem, + this.saveToolStripMenuItem}); + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.fileToolStripMenuItem.Text = "File"; + // + // openToolStripMenuItem + // + this.openToolStripMenuItem.Name = "openToolStripMenuItem"; + this.openToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.openToolStripMenuItem.Text = "Open"; + this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); + // + // saveToolStripMenuItem + // + this.saveToolStripMenuItem.Enabled = false; + this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; + this.saveToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.saveToolStripMenuItem.Text = "Save"; + this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click); + // + // mainTabControl + // + this.mainTabControl.Controls.Add(this.weaponsPage); + this.mainTabControl.Dock = System.Windows.Forms.DockStyle.Fill; + this.mainTabControl.Enabled = false; + this.mainTabControl.HotTrack = true; + this.mainTabControl.Location = new System.Drawing.Point(0, 24); + this.mainTabControl.Name = "mainTabControl"; + this.mainTabControl.SelectedIndex = 0; + this.mainTabControl.Size = new System.Drawing.Size(947, 735); + this.mainTabControl.TabIndex = 1; + // + // weaponsPage + // + this.weaponsPage.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.weaponsPage.Controls.Add(this.weaponSplitContainer); + this.weaponsPage.Location = new System.Drawing.Point(4, 24); + this.weaponsPage.Name = "weaponsPage"; + this.weaponsPage.Padding = new System.Windows.Forms.Padding(3); + this.weaponsPage.Size = new System.Drawing.Size(939, 707); + this.weaponsPage.TabIndex = 0; + this.weaponsPage.Text = "Weapons"; + this.weaponsPage.UseVisualStyleBackColor = true; + // + // weaponSplitContainer + // + this.weaponSplitContainer.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.weaponSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill; + this.weaponSplitContainer.Location = new System.Drawing.Point(3, 3); + this.weaponSplitContainer.Name = "weaponSplitContainer"; + // + // weaponSplitContainer.Panel1 + // + this.weaponSplitContainer.Panel1.Controls.Add(this.weaponList); + // + // weaponSplitContainer.Panel2 + // + this.weaponSplitContainer.Panel2.Controls.Add(this.weaponClusterTabControl); + this.weaponSplitContainer.Size = new System.Drawing.Size(929, 697); + this.weaponSplitContainer.SplitterDistance = 308; + this.weaponSplitContainer.TabIndex = 0; + // + // weaponList + // + this.weaponList.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.weaponList.Dock = System.Windows.Forms.DockStyle.Fill; + this.weaponList.FormattingEnabled = true; + this.weaponList.ItemHeight = 15; + this.weaponList.Location = new System.Drawing.Point(0, 0); + this.weaponList.Name = "weaponList"; + this.weaponList.Size = new System.Drawing.Size(304, 693); + this.weaponList.TabIndex = 0; + this.weaponList.SelectedIndexChanged += new System.EventHandler(this.weaponList_SelectedIndexChanged); + // + // weaponClusterTabControl + // + this.weaponClusterTabControl.Controls.Add(this.mainWeaponPage); + this.weaponClusterTabControl.Controls.Add(this.clustersPage); + this.weaponClusterTabControl.Dock = System.Windows.Forms.DockStyle.Fill; + this.weaponClusterTabControl.HotTrack = true; + this.weaponClusterTabControl.Location = new System.Drawing.Point(0, 0); + this.weaponClusterTabControl.Name = "weaponClusterTabControl"; + this.weaponClusterTabControl.SelectedIndex = 0; + this.weaponClusterTabControl.Size = new System.Drawing.Size(613, 693); + this.weaponClusterTabControl.TabIndex = 0; + // + // mainWeaponPage + // + this.mainWeaponPage.BackColor = System.Drawing.Color.LightGray; + this.mainWeaponPage.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.mainWeaponPage.Controls.Add(this.weaponPanel); + this.mainWeaponPage.Location = new System.Drawing.Point(4, 24); + this.mainWeaponPage.Name = "mainWeaponPage"; + this.mainWeaponPage.Padding = new System.Windows.Forms.Padding(3); + this.mainWeaponPage.Size = new System.Drawing.Size(605, 665); + this.mainWeaponPage.TabIndex = 0; + this.mainWeaponPage.Text = "Main Weapon"; + // + // weaponPanel + // + this.weaponPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.weaponPanel.Location = new System.Drawing.Point(3, 3); + this.weaponPanel.Name = "weaponPanel"; + this.weaponPanel.Size = new System.Drawing.Size(595, 655); + this.weaponPanel.TabIndex = 0; + // + // clustersPage + // + this.clustersPage.BackColor = System.Drawing.Color.LightGray; + this.clustersPage.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.clustersPage.Controls.Add(this.clusterPanel); + this.clustersPage.Location = new System.Drawing.Point(4, 24); + this.clustersPage.Name = "clustersPage"; + this.clustersPage.Padding = new System.Windows.Forms.Padding(3); + this.clustersPage.Size = new System.Drawing.Size(192, 72); + this.clustersPage.TabIndex = 1; + this.clustersPage.Text = "Clusters"; + // + // clusterPanel + // + this.clusterPanel.Dock = System.Windows.Forms.DockStyle.Fill; + this.clusterPanel.Location = new System.Drawing.Point(3, 3); + this.clusterPanel.Name = "clusterPanel"; + this.clusterPanel.Size = new System.Drawing.Size(182, 62); + this.clusterPanel.TabIndex = 1; + // + // groupBox1 + // + this.groupBox1.Location = new System.Drawing.Point(0, 0); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(200, 100); + this.groupBox1.TabIndex = 0; + this.groupBox1.TabStop = false; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Inset; + this.tableLayoutPanel1.ColumnCount = 2; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.Controls.Add(this.label1, 0, 1); + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 2; + this.tableLayoutPanel1.Size = new System.Drawing.Size(200, 100); + this.tableLayoutPanel1.TabIndex = 0; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Dock = System.Windows.Forms.DockStyle.Fill; + this.label1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.label1.Location = new System.Drawing.Point(5, 4); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(83, 94); + this.label1.TabIndex = 7; + this.label1.Text = "Weapon Type:"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // comboBox1 + // + this.comboBox1.DisplayMember = "0"; + this.comboBox1.Dock = System.Windows.Forms.DockStyle.Top; + this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Items.AddRange(new object[] { + "Air Strike", + "Launched", + "Thrown"}); + this.comboBox1.Location = new System.Drawing.Point(96, 7); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(651, 23); + this.comboBox1.TabIndex = 6; + // + // tableLayoutPanel11 + // + this.tableLayoutPanel11.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Inset; + this.tableLayoutPanel11.ColumnCount = 2; + this.tableLayoutPanel11.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel11.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel11.Controls.Add(this.label21, 0, 4); + this.tableLayoutPanel11.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel11.Name = "tableLayoutPanel11"; + this.tableLayoutPanel11.RowCount = 5; + this.tableLayoutPanel11.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel11.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel11.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel11.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel11.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel11.Size = new System.Drawing.Size(200, 100); + this.tableLayoutPanel11.TabIndex = 0; + // + // label21 + // + this.label21.AutoSize = true; + this.label21.Dock = System.Windows.Forms.DockStyle.Fill; + this.label21.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.label21.Location = new System.Drawing.Point(5, 90); + this.label21.Name = "label21"; + this.label21.Size = new System.Drawing.Size(117, 20); + this.label21.TabIndex = 14; + this.label21.Text = "Max Throw Strength:"; + this.label21.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label22 + // + this.label22.AutoSize = true; + this.label22.Dock = System.Windows.Forms.DockStyle.Fill; + this.label22.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.label22.Location = new System.Drawing.Point(5, 8); + this.label22.Name = "label22"; + this.label22.Size = new System.Drawing.Size(117, 15); + this.label22.TabIndex = 13; + this.label22.Text = "Blast DMG Radius:"; + this.label22.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // Main + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.LightGray; + this.ClientSize = new System.Drawing.Size(947, 759); + this.Controls.Add(this.mainTabControl); + this.Controls.Add(this.mainMenuStrip); + this.MainMenuStrip = this.mainMenuStrip; + this.Name = "Main"; + this.Text = "Worms 4: Mayhem! (Save Editor)"; + this.Load += new System.EventHandler(this.W4Gui_Load); + this.mainMenuStrip.ResumeLayout(false); + this.mainMenuStrip.PerformLayout(); + this.mainTabControl.ResumeLayout(false); + this.weaponsPage.ResumeLayout(false); + this.weaponSplitContainer.Panel1.ResumeLayout(false); + this.weaponSplitContainer.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.weaponSplitContainer)).EndInit(); + this.weaponSplitContainer.ResumeLayout(false); + this.weaponClusterTabControl.ResumeLayout(false); + this.mainWeaponPage.ResumeLayout(false); + this.clustersPage.ResumeLayout(false); + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.tableLayoutPanel11.ResumeLayout(false); + this.tableLayoutPanel11.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private MenuStrip mainMenuStrip; + private ToolStripMenuItem fileToolStripMenuItem; + private ToolStripMenuItem openToolStripMenuItem; + private ToolStripMenuItem saveToolStripMenuItem; + private TabControl mainTabControl; + private TabPage weaponsPage; + private SplitContainer weaponSplitContainer; + private ListBox weaponList; + private TabControl weaponClusterTabControl; + private TabPage mainWeaponPage; + private TabPage clustersPage; + private GroupBox groupBox1; + private TableLayoutPanel tableLayoutPanel1; + private Label label1; + private ComboBox comboBox1; + private TableLayoutPanel tableLayoutPanel11; + private Label label21; + private Label label22; + private WeaponsPanel weaponPanel; + private WeaponsPanel clusterPanel; + } +} \ No newline at end of file diff --git a/W4Gui/Main.cs b/W4Gui/Main.cs new file mode 100644 index 0000000..23bb2c1 --- /dev/null +++ b/W4Gui/Main.cs @@ -0,0 +1,114 @@ +using LibW4M; +using LibW4M.Data.WeaponFactory; +using LibXom; +using LibXom.Data; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace W4Gui +{ + public partial class Main : Form + { + private const string defaultTitle = "Worms 4: Mayhem! (Save Editor)"; + private bool loadedFile = false; + private W4SaveFile w4Save; + public Main() + { + InitializeComponent(); + } + + private void W4Gui_Load(object sender, EventArgs e) + { + + } + private void loadWeaponsData() + { + // load weapon factory data. + this.weaponList.Items.Clear(); + for (int i = 0; i < w4Save.WeaponFactoryCollective.Length; i++) + { + WeaponStore store = w4Save.WeaponFactoryCollective[i]; + this.weaponList.Items.Add(store.Weapon.Name.Value); + } + } + + private void loadAllData() + { + loadWeaponsData(); + } + private void openToolStripMenuItem_Click(object sender, EventArgs e) + { + OpenFileDialog fd = new OpenFileDialog(); + fd.Filter = "Worms 4: Mayhem Save File|*.xom"; + fd.Title = "Open Worms 4 Save File"; + if(fd.ShowDialog() == DialogResult.OK) + { + this.w4Save = new W4SaveFile(XomReader.ReadXomFile(fd.FileName)); + this.loadedFile = true; + + this.mainTabControl.Enabled = true; + this.saveToolStripMenuItem.Enabled = true; + + this.Text = defaultTitle + " [" + fd.FileName + "]"; + + this.loadAllData(); + this.weaponList.SelectedIndex = -1; + weaponList_SelectedIndexChanged(null, null); + } + } + + private void saveWeapon() + { + WeaponStore lastWeapStore = w4Save.WeaponFactoryCollective[lastSelected]; + weaponPanel.SaveWeaponData(ref lastWeapStore.Weapon); + clusterPanel.SaveWeaponData(ref lastWeapStore.Cluster); + weaponList.Items[lastSelected] = lastWeapStore.Weapon.Name.Value; + } + private int lastSelected = -1; + private void weaponList_SelectedIndexChanged(object sender, EventArgs e) + { + // Save last selected + if(lastSelected >= 0 && weaponList.SelectedIndex != lastSelected) + { + saveWeapon(); + } + if(weaponList.SelectedIndex >= 0 && weaponList.SelectedIndex != lastSelected) + { + WeaponStore weapStore = w4Save.WeaponFactoryCollective[weaponList.SelectedIndex]; + weaponPanel.LoadWeaponData(weapStore.Weapon); + clusterPanel.LoadWeaponData(weapStore.Cluster); + } + + if (this.weaponList.SelectedIndex == -1) + weaponClusterTabControl.Enabled = false; + else + weaponClusterTabControl.Enabled = true; + + lastSelected = weaponList.SelectedIndex; + } + + private void saveToolStripMenuItem_Click(object sender, EventArgs e) + { + SaveFileDialog fd = new SaveFileDialog(); + fd.Filter = "Worms 4: Mayhem Save File|*.xom"; + fd.Title = "Save Worms 4 Save File"; + if (fd.ShowDialog() == DialogResult.OK) + { + this.mainTabControl.Enabled = false; + //weaponList.SelectedIndex = -1; + + w4Save.Save(fd.FileName); + + this.mainTabControl.Enabled = true; + //weaponList.SelectedIndex = 0; + } + } + } +} diff --git a/W4Gui/Main.resx b/W4Gui/Main.resx new file mode 100644 index 0000000..f2d8197 --- /dev/null +++ b/W4Gui/Main.resx @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 12, 15 + + \ No newline at end of file diff --git a/W4Gui/Program.cs b/W4Gui/Program.cs new file mode 100644 index 0000000..2b77b51 --- /dev/null +++ b/W4Gui/Program.cs @@ -0,0 +1,17 @@ +namespace W4Gui +{ + internal static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + // To customize application configuration such as set high DPI settings or default font, + // see https://aka.ms/applicationconfiguration. + ApplicationConfiguration.Initialize(); + Application.Run(new Main()); + } + } +} \ No newline at end of file diff --git a/W4Gui/Properties/PublishProfiles/FolderProfile.pubxml b/W4Gui/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 0000000..a1b2e76 --- /dev/null +++ b/W4Gui/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,18 @@ + + + + + Release + Any CPU + bin\Release\net7.0-windows\publish\win-x64\ + FileSystem + <_TargetId>Folder + net7.0-windows + win-x64 + true + true + true + + \ No newline at end of file diff --git a/W4Gui/Properties/PublishProfiles/FolderProfile.pubxml.user b/W4Gui/Properties/PublishProfiles/FolderProfile.pubxml.user new file mode 100644 index 0000000..e913136 --- /dev/null +++ b/W4Gui/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -0,0 +1,10 @@ + + + + + True|2023-01-11T09:16:55.3469226Z; + + + \ No newline at end of file diff --git a/W4Gui/Properties/Resources.Designer.cs b/W4Gui/Properties/Resources.Designer.cs new file mode 100644 index 0000000..1b023fe --- /dev/null +++ b/W4Gui/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace W4Gui.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("W4Gui.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/W4Gui/Properties/Resources.resx b/W4Gui/Properties/Resources.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/W4Gui/Properties/Resources.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/W4Gui/W4Gui.csproj b/W4Gui/W4Gui.csproj new file mode 100644 index 0000000..e7d7358 --- /dev/null +++ b/W4Gui/W4Gui.csproj @@ -0,0 +1,37 @@ + + + + WinExe + net7.0-windows + enable + true + enable + + + + + Component + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + + + + + + + \ No newline at end of file diff --git a/W4Gui/W4Gui.csproj.user b/W4Gui/W4Gui.csproj.user new file mode 100644 index 0000000..82ba0cd --- /dev/null +++ b/W4Gui/W4Gui.csproj.user @@ -0,0 +1,20 @@ + + + + <_LastSelectedProfileId>C:\Users\Li\Documents\git\Worms4Editor\W4Gui\Properties\PublishProfiles\FolderProfile.pubxml + + + + Component + + + UserControl + + + Form + + + UserControl + + + \ No newline at end of file diff --git a/W4Gui/WeaponsPanel.Designer.cs b/W4Gui/WeaponsPanel.Designer.cs new file mode 100644 index 0000000..0d254fc --- /dev/null +++ b/W4Gui/WeaponsPanel.Designer.cs @@ -0,0 +1,961 @@ +namespace W4Gui +{ + partial class WeaponsPanel + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WeaponsPanel)); + this.weaponTabsControl = new System.Windows.Forms.TabControl(); + this.generalTab = new System.Windows.Forms.TabPage(); + this.generalTable = new System.Windows.Forms.TableLayoutPanel(); + this.selDetonation = new System.Windows.Forms.ComboBox(); + this.lblDetonation = new System.Windows.Forms.Label(); + this.lblFuseTime = new System.Windows.Forms.Label(); + this.selRetreatTime = new IntNumericUpDown(); + this.lblRetreatTime = new System.Windows.Forms.Label(); + this.lblWeapType = new System.Windows.Forms.Label(); + this.lblWeapName = new System.Windows.Forms.Label(); + this.selFuseTime = new IntNumericUpDown(); + this.selType = new System.Windows.Forms.ComboBox(); + this.selName = new System.Windows.Forms.TextBox(); + this.lblGeneralHint = new System.Windows.Forms.Label(); + this.powerTab = new System.Windows.Forms.TabPage(); + this.powerTable = new System.Windows.Forms.TableLayoutPanel(); + this.lblPowerHint = new System.Windows.Forms.Label(); + this.lblMaxThrowStr = new System.Windows.Forms.Label(); + this.lblBlastDmgRad = new System.Windows.Forms.Label(); + this.selLandDmgRad = new FloatNumericUpDown(); + this.lblLandDmgRad = new System.Windows.Forms.Label(); + this.selWormDmgMag = new FloatNumericUpDown(); + this.lblWormDmgStr = new System.Windows.Forms.Label(); + this.lblWormDmgRad = new System.Windows.Forms.Label(); + this.selWormDmgRad = new FloatNumericUpDown(); + this.selBlastDmgRad = new FloatNumericUpDown(); + this.selMaxThrowStr = new FloatNumericUpDown(); + this.clusterTab = new System.Windows.Forms.TabPage(); + this.clusterTable = new System.Windows.Forms.TableLayoutPanel(); + this.lblClustersHint = new System.Windows.Forms.Label(); + this.selClusterMaxSpeed = new FloatNumericUpDown(); + this.lblClusterSpeedMax = new System.Windows.Forms.Label(); + this.selClusterSpread = new FloatNumericUpDown(); + this.lblClusterSpread = new System.Windows.Forms.Label(); + this.lblNumCluster = new System.Windows.Forms.Label(); + this.selNumCluster = new IntNumericUpDown(); + this.technicalTab = new System.Windows.Forms.TabPage(); + this.technicalTable = new System.Windows.Forms.TableLayoutPanel(); + this.lblTechnicalHint = new System.Windows.Forms.Label(); + this.lblGraphicsResIds = new System.Windows.Forms.Label(); + this.lblGraphicsLocIds = new System.Windows.Forms.Label(); + this.selLaunchFx = new System.Windows.Forms.TextBox(); + this.selArielFx = new System.Windows.Forms.TextBox(); + this.selDetonationFx = new System.Windows.Forms.TextBox(); + this.lblDetonationFx = new System.Windows.Forms.Label(); + this.lblArielFx = new System.Windows.Forms.Label(); + this.lblLaunchFx = new System.Windows.Forms.Label(); + this.selCollisionRad = new FloatNumericUpDown(); + this.lblColRad = new System.Windows.Forms.Label(); + this.selPayloadId = new IntNumericUpDown(); + this.lblPayloadId = new System.Windows.Forms.Label(); + this.selGraphicalResoures = new W4Gui.ListWithAddAndDel(); + this.selGraphicalLocators = new W4Gui.ListWithAddAndDel(); + this.togglesTab = new System.Windows.Forms.TabPage(); + this.togglesTable = new System.Windows.Forms.TableLayoutPanel(); + this.selHoming = new System.Windows.Forms.CheckBox(); + this.selPowerUpLaunch = new System.Windows.Forms.CheckBox(); + this.selAdvancedHoming = new System.Windows.Forms.CheckBox(); + this.selFireOnGround = new System.Windows.Forms.CheckBox(); + this.selPoison = new System.Windows.Forms.CheckBox(); + this.selWindEffected = new System.Windows.Forms.CheckBox(); + this.weaponTabsControl.SuspendLayout(); + this.generalTab.SuspendLayout(); + this.generalTable.SuspendLayout(); + this.powerTab.SuspendLayout(); + this.powerTable.SuspendLayout(); + this.clusterTab.SuspendLayout(); + this.clusterTable.SuspendLayout(); + this.technicalTab.SuspendLayout(); + this.technicalTable.SuspendLayout(); + this.togglesTab.SuspendLayout(); + this.togglesTable.SuspendLayout(); + this.SuspendLayout(); + // + // weaponTabsControl + // + this.weaponTabsControl.Controls.Add(this.generalTab); + this.weaponTabsControl.Controls.Add(this.powerTab); + this.weaponTabsControl.Controls.Add(this.clusterTab); + this.weaponTabsControl.Controls.Add(this.technicalTab); + this.weaponTabsControl.Controls.Add(this.togglesTab); + this.weaponTabsControl.Dock = System.Windows.Forms.DockStyle.Fill; + this.weaponTabsControl.Location = new System.Drawing.Point(0, 0); + this.weaponTabsControl.Name = "weaponTabsControl"; + this.weaponTabsControl.SelectedIndex = 0; + this.weaponTabsControl.Size = new System.Drawing.Size(653, 428); + this.weaponTabsControl.TabIndex = 9; + // + // generalTab + // + this.generalTab.AutoScroll = true; + this.generalTab.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.generalTab.Controls.Add(this.generalTable); + this.generalTab.Location = new System.Drawing.Point(4, 24); + this.generalTab.Name = "generalTab"; + this.generalTab.Padding = new System.Windows.Forms.Padding(3); + this.generalTab.Size = new System.Drawing.Size(645, 400); + this.generalTab.TabIndex = 1; + this.generalTab.Text = "General"; + this.generalTab.UseVisualStyleBackColor = true; + // + // generalTable + // + this.generalTable.AutoSize = true; + this.generalTable.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Inset; + this.generalTable.ColumnCount = 2; + this.generalTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.generalTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.generalTable.Controls.Add(this.selDetonation, 1, 1); + this.generalTable.Controls.Add(this.lblDetonation, 0, 1); + this.generalTable.Controls.Add(this.lblFuseTime, 0, 4); + this.generalTable.Controls.Add(this.selRetreatTime, 1, 3); + this.generalTable.Controls.Add(this.lblRetreatTime, 0, 3); + this.generalTable.Controls.Add(this.lblWeapType, 0, 2); + this.generalTable.Controls.Add(this.lblWeapName, 0, 0); + this.generalTable.Controls.Add(this.selFuseTime, 1, 4); + this.generalTable.Controls.Add(this.selType, 1, 2); + this.generalTable.Controls.Add(this.selName, 1, 0); + this.generalTable.Controls.Add(this.lblGeneralHint, 1, 5); + this.generalTable.Dock = System.Windows.Forms.DockStyle.Top; + this.generalTable.Location = new System.Drawing.Point(3, 3); + this.generalTable.Name = "generalTable"; + this.generalTable.Padding = new System.Windows.Forms.Padding(3); + this.generalTable.RowCount = 6; + this.generalTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.generalTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.generalTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.generalTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.generalTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.generalTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.generalTable.Size = new System.Drawing.Size(635, 195); + this.generalTable.TabIndex = 6; + // + // selDetonation + // + this.selDetonation.Dock = System.Windows.Forms.DockStyle.Top; + this.selDetonation.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.selDetonation.FormattingEnabled = true; + this.selDetonation.Items.AddRange(new object[] { + "Impact", + "Fuse", + "User", + "Stops Moving"}); + this.selDetonation.Location = new System.Drawing.Point(93, 39); + this.selDetonation.Name = "selDetonation"; + this.selDetonation.Size = new System.Drawing.Size(534, 23); + this.selDetonation.TabIndex = 17; + // + // lblDetonation + // + this.lblDetonation.AutoSize = true; + this.lblDetonation.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblDetonation.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.lblDetonation.Location = new System.Drawing.Point(8, 36); + this.lblDetonation.Name = "lblDetonation"; + this.lblDetonation.Size = new System.Drawing.Size(77, 29); + this.lblDetonation.TabIndex = 16; + this.lblDetonation.Text = "Detonation:"; + this.lblDetonation.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lblFuseTime + // + this.lblFuseTime.AutoSize = true; + this.lblFuseTime.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblFuseTime.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.lblFuseTime.Location = new System.Drawing.Point(8, 129); + this.lblFuseTime.Name = "lblFuseTime"; + this.lblFuseTime.Size = new System.Drawing.Size(77, 29); + this.lblFuseTime.TabIndex = 13; + this.lblFuseTime.Text = "Fuse Time:"; + this.lblFuseTime.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // selRetreatTime + // + this.selRetreatTime.AutoSize = true; + this.selRetreatTime.Dock = System.Windows.Forms.DockStyle.Top; + this.selRetreatTime.Location = new System.Drawing.Point(93, 101); + this.selRetreatTime.Name = "selRetreatTime"; + this.selRetreatTime.Size = new System.Drawing.Size(534, 23); + this.selRetreatTime.TabIndex = 11; + // + // lblRetreatTime + // + this.lblRetreatTime.AutoSize = true; + this.lblRetreatTime.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblRetreatTime.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.lblRetreatTime.Location = new System.Drawing.Point(8, 98); + this.lblRetreatTime.Name = "lblRetreatTime"; + this.lblRetreatTime.Size = new System.Drawing.Size(77, 29); + this.lblRetreatTime.TabIndex = 10; + this.lblRetreatTime.Text = "Retreat Time:"; + this.lblRetreatTime.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lblWeapType + // + this.lblWeapType.AutoSize = true; + this.lblWeapType.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblWeapType.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.lblWeapType.Location = new System.Drawing.Point(8, 67); + this.lblWeapType.Name = "lblWeapType"; + this.lblWeapType.Size = new System.Drawing.Size(77, 29); + this.lblWeapType.TabIndex = 7; + this.lblWeapType.Text = "Type:"; + this.lblWeapType.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lblWeapName + // + this.lblWeapName.AutoSize = true; + this.lblWeapName.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblWeapName.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.lblWeapName.Location = new System.Drawing.Point(8, 5); + this.lblWeapName.Name = "lblWeapName"; + this.lblWeapName.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.lblWeapName.Size = new System.Drawing.Size(77, 29); + this.lblWeapName.TabIndex = 0; + this.lblWeapName.Text = "Name:"; + this.lblWeapName.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // selFuseTime + // + this.selFuseTime.AutoSize = true; + this.selFuseTime.Dock = System.Windows.Forms.DockStyle.Top; + this.selFuseTime.Location = new System.Drawing.Point(93, 132); + this.selFuseTime.Name = "selFuseTime"; + this.selFuseTime.Size = new System.Drawing.Size(534, 23); + this.selFuseTime.TabIndex = 12; + // + // selType + // + this.selType.Dock = System.Windows.Forms.DockStyle.Top; + this.selType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.selType.FormattingEnabled = true; + this.selType.Items.AddRange(new object[] { + "Air Strike", + "Launched", + "Thrown"}); + this.selType.Location = new System.Drawing.Point(93, 70); + this.selType.Name = "selType"; + this.selType.Size = new System.Drawing.Size(534, 23); + this.selType.TabIndex = 14; + // + // selName + // + this.selName.Dock = System.Windows.Forms.DockStyle.Fill; + this.selName.Location = new System.Drawing.Point(93, 8); + this.selName.Name = "selName"; + this.selName.PlaceholderText = "Weapon Name"; + this.selName.Size = new System.Drawing.Size(534, 23); + this.selName.TabIndex = 1; + // + // lblGeneralHint + // + this.lblGeneralHint.AutoSize = true; + this.lblGeneralHint.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblGeneralHint.Location = new System.Drawing.Point(93, 160); + this.lblGeneralHint.Name = "lblGeneralHint"; + this.lblGeneralHint.Size = new System.Drawing.Size(534, 30); + this.lblGeneralHint.TabIndex = 15; + this.lblGeneralHint.Text = "* Retreat/Fuse Time of -1 is treated as no timer\r\n\r\n"; + // + // powerTab + // + this.powerTab.AutoScroll = true; + this.powerTab.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.powerTab.Controls.Add(this.powerTable); + this.powerTab.Location = new System.Drawing.Point(4, 24); + this.powerTab.Name = "powerTab"; + this.powerTab.Size = new System.Drawing.Size(645, 400); + this.powerTab.TabIndex = 2; + this.powerTab.Text = "Power"; + this.powerTab.UseVisualStyleBackColor = true; + // + // powerTable + // + this.powerTable.AutoSize = true; + this.powerTable.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Inset; + this.powerTable.ColumnCount = 2; + this.powerTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.powerTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.powerTable.Controls.Add(this.lblPowerHint, 2, 5); + this.powerTable.Controls.Add(this.lblMaxThrowStr, 0, 4); + this.powerTable.Controls.Add(this.lblBlastDmgRad, 0, 3); + this.powerTable.Controls.Add(this.selLandDmgRad, 1, 2); + this.powerTable.Controls.Add(this.lblLandDmgRad, 0, 2); + this.powerTable.Controls.Add(this.selWormDmgMag, 1, 1); + this.powerTable.Controls.Add(this.lblWormDmgStr, 0, 1); + this.powerTable.Controls.Add(this.lblWormDmgRad, 0, 0); + this.powerTable.Controls.Add(this.selWormDmgRad, 1, 0); + this.powerTable.Controls.Add(this.selBlastDmgRad, 1, 3); + this.powerTable.Controls.Add(this.selMaxThrowStr, 1, 4); + this.powerTable.Dock = System.Windows.Forms.DockStyle.Top; + this.powerTable.Location = new System.Drawing.Point(0, 0); + this.powerTable.Name = "powerTable"; + this.powerTable.Padding = new System.Windows.Forms.Padding(3); + this.powerTable.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.powerTable.RowCount = 6; + this.powerTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.powerTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.powerTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.powerTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.powerTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.powerTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.powerTable.Size = new System.Drawing.Size(641, 255); + this.powerTable.TabIndex = 6; + // + // lblPowerHint + // + this.lblPowerHint.AutoSize = true; + this.lblPowerHint.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblPowerHint.Location = new System.Drawing.Point(137, 160); + this.lblPowerHint.Name = "lblPowerHint"; + this.lblPowerHint.Size = new System.Drawing.Size(496, 90); + this.lblPowerHint.TabIndex = 16; + this.lblPowerHint.Text = resources.GetString("lblPowerHint.Text"); + // + // lblMaxThrowStr + // + this.lblMaxThrowStr.AutoSize = true; + this.lblMaxThrowStr.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblMaxThrowStr.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.lblMaxThrowStr.Location = new System.Drawing.Point(8, 129); + this.lblMaxThrowStr.Name = "lblMaxThrowStr"; + this.lblMaxThrowStr.Size = new System.Drawing.Size(121, 29); + this.lblMaxThrowStr.TabIndex = 14; + this.lblMaxThrowStr.Text = "Max Throw Strength:"; + this.lblMaxThrowStr.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lblBlastDmgRad + // + this.lblBlastDmgRad.AutoSize = true; + this.lblBlastDmgRad.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblBlastDmgRad.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.lblBlastDmgRad.Location = new System.Drawing.Point(8, 98); + this.lblBlastDmgRad.Name = "lblBlastDmgRad"; + this.lblBlastDmgRad.Size = new System.Drawing.Size(121, 29); + this.lblBlastDmgRad.TabIndex = 13; + this.lblBlastDmgRad.Text = "Blast DMG Radius:"; + this.lblBlastDmgRad.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // selLandDmgRad + // + this.selLandDmgRad.Dock = System.Windows.Forms.DockStyle.Top; + this.selLandDmgRad.Location = new System.Drawing.Point(137, 70); + this.selLandDmgRad.Name = "selLandDmgRad"; + this.selLandDmgRad.Size = new System.Drawing.Size(496, 23); + this.selLandDmgRad.TabIndex = 11; + // + // lblLandDmgRad + // + this.lblLandDmgRad.AutoSize = true; + this.lblLandDmgRad.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblLandDmgRad.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.lblLandDmgRad.Location = new System.Drawing.Point(8, 67); + this.lblLandDmgRad.Name = "lblLandDmgRad"; + this.lblLandDmgRad.Size = new System.Drawing.Size(121, 29); + this.lblLandDmgRad.TabIndex = 10; + this.lblLandDmgRad.Text = "Land DMG Radius:"; + this.lblLandDmgRad.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // selWormDmgMag + // + this.selWormDmgMag.Dock = System.Windows.Forms.DockStyle.Top; + this.selWormDmgMag.Location = new System.Drawing.Point(137, 39); + this.selWormDmgMag.Name = "selWormDmgMag"; + this.selWormDmgMag.Size = new System.Drawing.Size(496, 23); + this.selWormDmgMag.TabIndex = 9; + // + // lblWormDmgStr + // + this.lblWormDmgStr.AutoSize = true; + this.lblWormDmgStr.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblWormDmgStr.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.lblWormDmgStr.Location = new System.Drawing.Point(8, 36); + this.lblWormDmgStr.Name = "lblWormDmgStr"; + this.lblWormDmgStr.Size = new System.Drawing.Size(121, 29); + this.lblWormDmgStr.TabIndex = 7; + this.lblWormDmgStr.Text = "Worm DMG Strength:"; + this.lblWormDmgStr.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lblWormDmgRad + // + this.lblWormDmgRad.AutoSize = true; + this.lblWormDmgRad.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblWormDmgRad.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.lblWormDmgRad.Location = new System.Drawing.Point(8, 5); + this.lblWormDmgRad.Name = "lblWormDmgRad"; + this.lblWormDmgRad.Size = new System.Drawing.Size(121, 29); + this.lblWormDmgRad.TabIndex = 0; + this.lblWormDmgRad.Text = "Worm DMG Radius:"; + this.lblWormDmgRad.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // selWormDmgRad + // + this.selWormDmgRad.Dock = System.Windows.Forms.DockStyle.Top; + this.selWormDmgRad.Location = new System.Drawing.Point(137, 8); + this.selWormDmgRad.Name = "selWormDmgRad"; + this.selWormDmgRad.Size = new System.Drawing.Size(496, 23); + this.selWormDmgRad.TabIndex = 8; + // + // selBlastDmgRad + // + this.selBlastDmgRad.Dock = System.Windows.Forms.DockStyle.Top; + this.selBlastDmgRad.Location = new System.Drawing.Point(137, 101); + this.selBlastDmgRad.Name = "selBlastDmgRad"; + this.selBlastDmgRad.Size = new System.Drawing.Size(496, 23); + this.selBlastDmgRad.TabIndex = 12; + // + // selMaxThrowStr + // + this.selMaxThrowStr.Dock = System.Windows.Forms.DockStyle.Top; + this.selMaxThrowStr.Location = new System.Drawing.Point(137, 132); + this.selMaxThrowStr.Name = "selMaxThrowStr"; + this.selMaxThrowStr.Size = new System.Drawing.Size(496, 23); + this.selMaxThrowStr.TabIndex = 15; + // + // clusterTab + // + this.clusterTab.AutoScroll = true; + this.clusterTab.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.clusterTab.Controls.Add(this.clusterTable); + this.clusterTab.Location = new System.Drawing.Point(4, 24); + this.clusterTab.Name = "clusterTab"; + this.clusterTab.Padding = new System.Windows.Forms.Padding(3); + this.clusterTab.Size = new System.Drawing.Size(645, 400); + this.clusterTab.TabIndex = 3; + this.clusterTab.Text = "Clusters"; + this.clusterTab.UseVisualStyleBackColor = true; + // + // clusterTable + // + this.clusterTable.AutoSize = true; + this.clusterTable.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Inset; + this.clusterTable.ColumnCount = 2; + this.clusterTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.clusterTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.clusterTable.Controls.Add(this.lblClustersHint, 1, 3); + this.clusterTable.Controls.Add(this.selClusterMaxSpeed, 1, 2); + this.clusterTable.Controls.Add(this.lblClusterSpeedMax, 0, 2); + this.clusterTable.Controls.Add(this.selClusterSpread, 1, 1); + this.clusterTable.Controls.Add(this.lblClusterSpread, 0, 1); + this.clusterTable.Controls.Add(this.lblNumCluster, 0, 0); + this.clusterTable.Controls.Add(this.selNumCluster, 1, 0); + this.clusterTable.Dock = System.Windows.Forms.DockStyle.Top; + this.clusterTable.Location = new System.Drawing.Point(3, 3); + this.clusterTable.Name = "clusterTable"; + this.clusterTable.RowCount = 4; + this.clusterTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.clusterTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.clusterTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.clusterTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.clusterTable.Size = new System.Drawing.Size(635, 247); + this.clusterTable.TabIndex = 6; + // + // lblClustersHint + // + this.lblClustersHint.AutoSize = true; + this.lblClustersHint.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblClustersHint.Location = new System.Drawing.Point(126, 95); + this.lblClustersHint.Name = "lblClustersHint"; + this.lblClustersHint.Size = new System.Drawing.Size(504, 150); + this.lblClustersHint.TabIndex = 17; + this.lblClustersHint.Text = resources.GetString("lblClustersHint.Text"); + // + // selClusterMaxSpeed + // + this.selClusterMaxSpeed.Dock = System.Windows.Forms.DockStyle.Top; + this.selClusterMaxSpeed.Location = new System.Drawing.Point(126, 67); + this.selClusterMaxSpeed.Name = "selClusterMaxSpeed"; + this.selClusterMaxSpeed.Size = new System.Drawing.Size(504, 23); + this.selClusterMaxSpeed.TabIndex = 11; + // + // lblClusterSpeedMax + // + this.lblClusterSpeedMax.AutoSize = true; + this.lblClusterSpeedMax.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblClusterSpeedMax.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.lblClusterSpeedMax.Location = new System.Drawing.Point(5, 64); + this.lblClusterSpeedMax.Name = "lblClusterSpeedMax"; + this.lblClusterSpeedMax.Size = new System.Drawing.Size(113, 29); + this.lblClusterSpeedMax.TabIndex = 10; + this.lblClusterSpeedMax.Text = "Cluster Max Speed:"; + this.lblClusterSpeedMax.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // selClusterSpread + // + this.selClusterSpread.Dock = System.Windows.Forms.DockStyle.Top; + this.selClusterSpread.Location = new System.Drawing.Point(126, 36); + this.selClusterSpread.Name = "selClusterSpread"; + this.selClusterSpread.Size = new System.Drawing.Size(504, 23); + this.selClusterSpread.TabIndex = 9; + // + // lblClusterSpread + // + this.lblClusterSpread.AutoSize = true; + this.lblClusterSpread.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblClusterSpread.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.lblClusterSpread.Location = new System.Drawing.Point(5, 33); + this.lblClusterSpread.Name = "lblClusterSpread"; + this.lblClusterSpread.Size = new System.Drawing.Size(113, 29); + this.lblClusterSpread.TabIndex = 7; + this.lblClusterSpread.Text = "Cluster Spread:"; + this.lblClusterSpread.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lblNumCluster + // + this.lblNumCluster.AutoSize = true; + this.lblNumCluster.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblNumCluster.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.lblNumCluster.Location = new System.Drawing.Point(5, 2); + this.lblNumCluster.Name = "lblNumCluster"; + this.lblNumCluster.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.lblNumCluster.Size = new System.Drawing.Size(113, 29); + this.lblNumCluster.TabIndex = 0; + this.lblNumCluster.Text = "Number of Clusters:"; + this.lblNumCluster.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // selNumCluster + // + this.selNumCluster.Dock = System.Windows.Forms.DockStyle.Top; + this.selNumCluster.Location = new System.Drawing.Point(126, 5); + this.selNumCluster.Name = "selNumCluster"; + this.selNumCluster.Size = new System.Drawing.Size(504, 23); + this.selNumCluster.TabIndex = 8; + // + // technicalTab + // + this.technicalTab.AutoScroll = true; + this.technicalTab.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.technicalTab.Controls.Add(this.technicalTable); + this.technicalTab.Location = new System.Drawing.Point(4, 24); + this.technicalTab.Name = "technicalTab"; + this.technicalTab.Size = new System.Drawing.Size(645, 400); + this.technicalTab.TabIndex = 4; + this.technicalTab.Text = "Technical"; + this.technicalTab.UseVisualStyleBackColor = true; + // + // technicalTable + // + this.technicalTable.AutoSize = true; + this.technicalTable.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Inset; + this.technicalTable.ColumnCount = 2; + this.technicalTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.technicalTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.technicalTable.Controls.Add(this.lblTechnicalHint, 1, 7); + this.technicalTable.Controls.Add(this.lblGraphicsResIds, 0, 5); + this.technicalTable.Controls.Add(this.lblGraphicsLocIds, 0, 6); + this.technicalTable.Controls.Add(this.selLaunchFx, 1, 2); + this.technicalTable.Controls.Add(this.selArielFx, 2, 3); + this.technicalTable.Controls.Add(this.selDetonationFx, 1, 4); + this.technicalTable.Controls.Add(this.lblDetonationFx, 0, 4); + this.technicalTable.Controls.Add(this.lblArielFx, 0, 3); + this.technicalTable.Controls.Add(this.lblLaunchFx, 0, 2); + this.technicalTable.Controls.Add(this.selCollisionRad, 1, 1); + this.technicalTable.Controls.Add(this.lblColRad, 0, 1); + this.technicalTable.Controls.Add(this.selPayloadId, 1, 0); + this.technicalTable.Controls.Add(this.lblPayloadId, 0, 0); + this.technicalTable.Controls.Add(this.selGraphicalResoures, 1, 5); + this.technicalTable.Controls.Add(this.selGraphicalLocators, 1, 6); + this.technicalTable.Dock = System.Windows.Forms.DockStyle.Top; + this.technicalTable.Location = new System.Drawing.Point(0, 0); + this.technicalTable.Name = "technicalTable"; + this.technicalTable.Padding = new System.Windows.Forms.Padding(3); + this.technicalTable.RowCount = 8; + this.technicalTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.technicalTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.technicalTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.technicalTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.technicalTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.technicalTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.technicalTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.technicalTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.technicalTable.Size = new System.Drawing.Size(624, 625); + this.technicalTable.TabIndex = 6; + // + // lblTechnicalHint + // + this.lblTechnicalHint.AutoSize = true; + this.lblTechnicalHint.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblTechnicalHint.Location = new System.Drawing.Point(132, 545); + this.lblTechnicalHint.Name = "lblTechnicalHint"; + this.lblTechnicalHint.Size = new System.Drawing.Size(484, 75); + this.lblTechnicalHint.TabIndex = 24; + this.lblTechnicalHint.Text = "* This is information on what graphics to load when your weapon used\r\n\r\n* EDITING" + + " THIS HAS A VERY HIGH CHANCE TO CRASH THE GAME\r\n\r\n\r\n"; + // + // lblGraphicsResIds + // + this.lblGraphicsResIds.AutoSize = true; + this.lblGraphicsResIds.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblGraphicsResIds.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.lblGraphicsResIds.Location = new System.Drawing.Point(8, 160); + this.lblGraphicsResIds.Name = "lblGraphicsResIds"; + this.lblGraphicsResIds.Size = new System.Drawing.Size(116, 185); + this.lblGraphicsResIds.TabIndex = 23; + this.lblGraphicsResIds.Text = "Graphical Resources:"; + this.lblGraphicsResIds.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lblGraphicsLocIds + // + this.lblGraphicsLocIds.AutoSize = true; + this.lblGraphicsLocIds.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblGraphicsLocIds.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.lblGraphicsLocIds.Location = new System.Drawing.Point(8, 347); + this.lblGraphicsLocIds.Name = "lblGraphicsLocIds"; + this.lblGraphicsLocIds.Size = new System.Drawing.Size(116, 196); + this.lblGraphicsLocIds.TabIndex = 22; + this.lblGraphicsLocIds.Text = "Graphical Locators:"; + this.lblGraphicsLocIds.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // selLaunchFx + // + this.selLaunchFx.AccessibleRole = System.Windows.Forms.AccessibleRole.None; + this.selLaunchFx.Dock = System.Windows.Forms.DockStyle.Top; + this.selLaunchFx.Location = new System.Drawing.Point(132, 70); + this.selLaunchFx.Name = "selLaunchFx"; + this.selLaunchFx.PlaceholderText = "Launch FX"; + this.selLaunchFx.Size = new System.Drawing.Size(484, 23); + this.selLaunchFx.TabIndex = 19; + // + // selArielFx + // + this.selArielFx.AccessibleRole = System.Windows.Forms.AccessibleRole.None; + this.selArielFx.Dock = System.Windows.Forms.DockStyle.Top; + this.selArielFx.Location = new System.Drawing.Point(132, 101); + this.selArielFx.Name = "selArielFx"; + this.selArielFx.PlaceholderText = "Ariel FX"; + this.selArielFx.Size = new System.Drawing.Size(484, 23); + this.selArielFx.TabIndex = 18; + // + // selDetonationFx + // + this.selDetonationFx.Dock = System.Windows.Forms.DockStyle.Top; + this.selDetonationFx.Location = new System.Drawing.Point(132, 132); + this.selDetonationFx.Name = "selDetonationFx"; + this.selDetonationFx.PlaceholderText = "Detonation FX"; + this.selDetonationFx.Size = new System.Drawing.Size(484, 23); + this.selDetonationFx.TabIndex = 17; + // + // lblDetonationFx + // + this.lblDetonationFx.AutoSize = true; + this.lblDetonationFx.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblDetonationFx.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.lblDetonationFx.Location = new System.Drawing.Point(8, 129); + this.lblDetonationFx.Name = "lblDetonationFx"; + this.lblDetonationFx.Size = new System.Drawing.Size(116, 29); + this.lblDetonationFx.TabIndex = 16; + this.lblDetonationFx.Text = "Detonation Effect:"; + this.lblDetonationFx.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lblArielFx + // + this.lblArielFx.AutoSize = true; + this.lblArielFx.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblArielFx.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.lblArielFx.Location = new System.Drawing.Point(8, 98); + this.lblArielFx.Name = "lblArielFx"; + this.lblArielFx.Size = new System.Drawing.Size(116, 29); + this.lblArielFx.TabIndex = 15; + this.lblArielFx.Text = "Ariel Effect:"; + this.lblArielFx.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // lblLaunchFx + // + this.lblLaunchFx.AutoSize = true; + this.lblLaunchFx.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblLaunchFx.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.lblLaunchFx.Location = new System.Drawing.Point(8, 67); + this.lblLaunchFx.Name = "lblLaunchFx"; + this.lblLaunchFx.Size = new System.Drawing.Size(116, 29); + this.lblLaunchFx.TabIndex = 14; + this.lblLaunchFx.Text = "Launch Effect:"; + this.lblLaunchFx.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // selCollisionRad + // + this.selCollisionRad.Dock = System.Windows.Forms.DockStyle.Top; + this.selCollisionRad.Location = new System.Drawing.Point(132, 39); + this.selCollisionRad.Name = "selCollisionRad"; + this.selCollisionRad.Size = new System.Drawing.Size(484, 23); + this.selCollisionRad.TabIndex = 13; + // + // lblColRad + // + this.lblColRad.AutoSize = true; + this.lblColRad.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblColRad.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.lblColRad.Location = new System.Drawing.Point(8, 36); + this.lblColRad.Name = "lblColRad"; + this.lblColRad.Size = new System.Drawing.Size(116, 29); + this.lblColRad.TabIndex = 12; + this.lblColRad.Text = "Collison Radius:"; + this.lblColRad.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // selPayloadId + // + this.selPayloadId.Dock = System.Windows.Forms.DockStyle.Top; + this.selPayloadId.Location = new System.Drawing.Point(132, 8); + this.selPayloadId.Name = "selPayloadId"; + this.selPayloadId.Size = new System.Drawing.Size(484, 23); + this.selPayloadId.TabIndex = 11; + // + // lblPayloadId + // + this.lblPayloadId.AutoSize = true; + this.lblPayloadId.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblPayloadId.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.lblPayloadId.Location = new System.Drawing.Point(8, 5); + this.lblPayloadId.Name = "lblPayloadId"; + this.lblPayloadId.Size = new System.Drawing.Size(116, 29); + this.lblPayloadId.TabIndex = 10; + this.lblPayloadId.Text = "Payload ID:"; + this.lblPayloadId.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // selGraphicalResoures + // + this.selGraphicalResoures.Dock = System.Windows.Forms.DockStyle.Fill; + this.selGraphicalResoures.Location = new System.Drawing.Point(132, 163); + this.selGraphicalResoures.Name = "selGraphicalResoures"; + this.selGraphicalResoures.Size = new System.Drawing.Size(484, 179); + this.selGraphicalResoures.TabIndex = 25; + // + // selGraphicalLocators + // + this.selGraphicalLocators.Dock = System.Windows.Forms.DockStyle.Fill; + this.selGraphicalLocators.Location = new System.Drawing.Point(132, 350); + this.selGraphicalLocators.Name = "selGraphicalLocators"; + this.selGraphicalLocators.Size = new System.Drawing.Size(484, 190); + this.selGraphicalLocators.TabIndex = 26; + // + // togglesTab + // + this.togglesTab.AutoScroll = true; + this.togglesTab.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; + this.togglesTab.Controls.Add(this.togglesTable); + this.togglesTab.Location = new System.Drawing.Point(4, 24); + this.togglesTab.Name = "togglesTab"; + this.togglesTab.Size = new System.Drawing.Size(645, 400); + this.togglesTab.TabIndex = 5; + this.togglesTab.Text = "Toggles"; + this.togglesTab.UseVisualStyleBackColor = true; + // + // togglesTable + // + this.togglesTable.AutoSize = true; + this.togglesTable.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.Inset; + this.togglesTable.ColumnCount = 2; + this.togglesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.togglesTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.togglesTable.Controls.Add(this.selHoming, 0, 0); + this.togglesTable.Controls.Add(this.selPowerUpLaunch, 0, 2); + this.togglesTable.Controls.Add(this.selAdvancedHoming, 1, 0); + this.togglesTable.Controls.Add(this.selFireOnGround, 1, 2); + this.togglesTable.Controls.Add(this.selPoison, 0, 1); + this.togglesTable.Controls.Add(this.selWindEffected, 1, 1); + this.togglesTable.Dock = System.Windows.Forms.DockStyle.Top; + this.togglesTable.Location = new System.Drawing.Point(0, 0); + this.togglesTable.Name = "togglesTable"; + this.togglesTable.Padding = new System.Windows.Forms.Padding(3); + this.togglesTable.RowCount = 3; + this.togglesTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.togglesTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.togglesTable.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.togglesTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.togglesTable.Size = new System.Drawing.Size(641, 89); + this.togglesTable.TabIndex = 7; + // + // selHoming + // + this.selHoming.AutoSize = true; + this.selHoming.Dock = System.Windows.Forms.DockStyle.Fill; + this.selHoming.Location = new System.Drawing.Point(8, 8); + this.selHoming.Name = "selHoming"; + this.selHoming.Size = new System.Drawing.Size(308, 19); + this.selHoming.TabIndex = 0; + this.selHoming.Text = "Homing"; + this.selHoming.UseVisualStyleBackColor = true; + // + // selPowerUpLaunch + // + this.selPowerUpLaunch.AutoSize = true; + this.selPowerUpLaunch.Dock = System.Windows.Forms.DockStyle.Fill; + this.selPowerUpLaunch.Location = new System.Drawing.Point(8, 62); + this.selPowerUpLaunch.Name = "selPowerUpLaunch"; + this.selPowerUpLaunch.Size = new System.Drawing.Size(308, 19); + this.selPowerUpLaunch.TabIndex = 5; + this.selPowerUpLaunch.Text = "Power Up Launch"; + this.selPowerUpLaunch.UseVisualStyleBackColor = true; + // + // selHomingAvoidLand + // + this.selAdvancedHoming.AutoSize = true; + this.selAdvancedHoming.Dock = System.Windows.Forms.DockStyle.Fill; + this.selAdvancedHoming.Location = new System.Drawing.Point(324, 8); + this.selAdvancedHoming.Name = "selHomingAvoidLand"; + this.selAdvancedHoming.Size = new System.Drawing.Size(309, 19); + this.selAdvancedHoming.TabIndex = 1; + this.selAdvancedHoming.Text = "Advanced Homing"; + this.selAdvancedHoming.UseVisualStyleBackColor = true; + // + // selFireOnGround + // + this.selFireOnGround.AutoSize = true; + this.selFireOnGround.Dock = System.Windows.Forms.DockStyle.Fill; + this.selFireOnGround.Location = new System.Drawing.Point(324, 62); + this.selFireOnGround.Name = "selFireOnGround"; + this.selFireOnGround.Size = new System.Drawing.Size(309, 19); + this.selFireOnGround.TabIndex = 3; + this.selFireOnGround.Text = "Fire On Ground"; + this.selFireOnGround.UseVisualStyleBackColor = true; + // + // selPoison + // + this.selPoison.AutoSize = true; + this.selPoison.Dock = System.Windows.Forms.DockStyle.Fill; + this.selPoison.Location = new System.Drawing.Point(8, 35); + this.selPoison.Name = "selPoison"; + this.selPoison.Size = new System.Drawing.Size(308, 19); + this.selPoison.TabIndex = 4; + this.selPoison.Text = "Poison"; + this.selPoison.UseVisualStyleBackColor = true; + // + // selWindEffected + // + this.selWindEffected.AutoSize = true; + this.selWindEffected.Dock = System.Windows.Forms.DockStyle.Fill; + this.selWindEffected.Location = new System.Drawing.Point(324, 35); + this.selWindEffected.Name = "selWindEffected"; + this.selWindEffected.Size = new System.Drawing.Size(309, 19); + this.selWindEffected.TabIndex = 2; + this.selWindEffected.Text = "Wind Effected"; + this.selWindEffected.UseVisualStyleBackColor = true; + // + // WeaponsPanel + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.weaponTabsControl); + this.Name = "WeaponsPanel"; + this.Size = new System.Drawing.Size(653, 428); + this.weaponTabsControl.ResumeLayout(false); + this.generalTab.ResumeLayout(false); + this.generalTab.PerformLayout(); + this.generalTable.ResumeLayout(false); + this.generalTable.PerformLayout(); + this.powerTab.ResumeLayout(false); + this.powerTab.PerformLayout(); + this.powerTable.ResumeLayout(false); + this.powerTable.PerformLayout(); + this.clusterTab.ResumeLayout(false); + this.clusterTab.PerformLayout(); + this.clusterTable.ResumeLayout(false); + this.clusterTable.PerformLayout(); + this.technicalTab.ResumeLayout(false); + this.technicalTab.PerformLayout(); + this.technicalTable.ResumeLayout(false); + this.technicalTable.PerformLayout(); + this.togglesTab.ResumeLayout(false); + this.togglesTab.PerformLayout(); + this.togglesTable.ResumeLayout(false); + this.togglesTable.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private TabControl weaponTabsControl; + private TabPage generalTab; + private TableLayoutPanel generalTable; + private ComboBox selDetonation; + private Label lblFuseTime; + private IntNumericUpDown selRetreatTime; + private Label lblRetreatTime; + private Label lblWeapType; + private Label lblWeapName; + private IntNumericUpDown selFuseTime; + private ComboBox selType; + private TextBox selName; + private Label lblGeneralHint; + private TabPage powerTab; + private TableLayoutPanel powerTable; + private Label lblPowerHint; + private Label lblMaxThrowStr; + private Label lblBlastDmgRad; + private FloatNumericUpDown selLandDmgRad; + private Label lblLandDmgRad; + private FloatNumericUpDown selWormDmgMag; + private Label lblWormDmgStr; + private Label lblWormDmgRad; + private FloatNumericUpDown selWormDmgRad; + private FloatNumericUpDown selBlastDmgRad; + private FloatNumericUpDown selMaxThrowStr; + private TabPage clusterTab; + private TableLayoutPanel clusterTable; + private Label lblClustersHint; + private FloatNumericUpDown selClusterMaxSpeed; + private Label lblClusterSpeedMax; + private FloatNumericUpDown selClusterSpread; + private Label lblClusterSpread; + private Label lblNumCluster; + private IntNumericUpDown selNumCluster; + private TabPage technicalTab; + private TabPage togglesTab; + private TableLayoutPanel togglesTable; + private CheckBox selHoming; + private CheckBox selPowerUpLaunch; + private CheckBox selAdvancedHoming; + private CheckBox selFireOnGround; + private CheckBox selPoison; + private CheckBox selWindEffected; + private TableLayoutPanel technicalTable; + private Label lblTechnicalHint; + private Label lblGraphicsResIds; + private Label lblGraphicsLocIds; + private TextBox selLaunchFx; + private TextBox selArielFx; + private TextBox selDetonationFx; + private Label lblDetonationFx; + private Label lblArielFx; + private Label lblLaunchFx; + private FloatNumericUpDown selCollisionRad; + private Label lblColRad; + private IntNumericUpDown selPayloadId; + private Label lblPayloadId; + private ListWithAddAndDel selGraphicalResoures; + private ListWithAddAndDel selGraphicalLocators; + private Label lblDetonation; + } +} diff --git a/W4Gui/WeaponsPanel.cs b/W4Gui/WeaponsPanel.cs new file mode 100644 index 0000000..28644cb --- /dev/null +++ b/W4Gui/WeaponsPanel.cs @@ -0,0 +1,153 @@ +using LibW4M.Data.WeaponFactory; +using LibXom.Data; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace W4Gui +{ + public partial class WeaponsPanel : UserControl + { + public float ConvertToFloat(decimal value) + { + try + { + if (value.Equals(Decimal.MaxValue)) return Single.NaN; + if (value.Equals(Decimal.MaxValue-1)) return Single.PositiveInfinity; + if (value.Equals(Decimal.MaxValue - 2)) return Single.NegativeInfinity; + return Convert.ToSingle(value); + } + catch (OverflowException) + { + return float.MaxValue; + } + } + public decimal ConvertToDecimal(float value) + { + try + { + return Convert.ToDecimal(value); + } + catch (OverflowException) + { + if (float.IsNaN(value)) return Decimal.MaxValue; + else if (float.IsPositiveInfinity(value)) return Decimal.MaxValue - 1; + else if (float.IsNegativeInfinity(value)) return Decimal.MaxValue - 2; + else return Decimal.MaxValue - 3; + } + } + public void SaveWeaponData(ref WeaponContainer weapon) + { + // Save general settings + weapon.Name.Value = this.selName.Text; + weapon.DetonationType = (DetonationType)this.selDetonation.SelectedIndex; + weapon.ProjectileLaunchType = (ProjectileLaunchType)this.selType.SelectedIndex; + weapon.RetreatTime = this.selRetreatTime.Value; + weapon.FuseTime = this.selFuseTime.Value; + + // Save power settings + weapon.WormDamageRadius = this.selWormDmgRad.Value; + weapon.WormDamageMagnitude = this.selWormDmgMag.Value; + weapon.LandDamageRadius = this.selLandDmgRad.Value; + weapon.Push = this.selBlastDmgRad.Value; + weapon.ProjectileMaxPower = this.selMaxThrowStr.Value; + + // Save clusters + + weapon.ProjectileNumClusters = this.selNumCluster.Value; + weapon.ClusterSpread = this.selClusterSpread.Value; + weapon.ClusterMaxSpeed = this.selClusterMaxSpeed.Value; + + // Save technical + + weapon.PayloadResourceId = this.selPayloadId.Value; + weapon.ProjectileCollisionRadius = this.selCollisionRad.Value; + weapon.LaunchFX = weapon.OriginalSave.LookupString(this.selLaunchFx.Text); + weapon.ArielFX = weapon.OriginalSave.LookupString(this.selArielFx.Text); + weapon.DetonationFX = weapon.OriginalSave.LookupString(this.selDetonationFx.Text); + + // Save graphical resources + string[] graphicalResources = this.selGraphicalResoures.Items; + string[] graphicalLocators = this.selGraphicalLocators.Items; + + weapon.GraphicalResources = new XomString[graphicalResources.Length]; + for (int i = 0; i < graphicalResources.Length; i++) + weapon.GraphicalResources[i] = weapon.OriginalSave.LookupString(graphicalResources[i]); + + weapon.GraphicalLocators = new XomString[graphicalLocators.Length]; + for (int i = 0; i < graphicalLocators.Length; i++) + weapon.GraphicalLocators[i] = weapon.OriginalSave.LookupString(graphicalLocators[i]); + + + // Save toggles + + weapon.Homing = this.selHoming.Checked; + weapon.HomingAvoidLand = this.selAdvancedHoming.Checked; + weapon.Poison = this.selPoison.Checked; + weapon.EffectedByWind = this.selWindEffected.Checked; + weapon.ProjectilePowersUp = this.selPowerUpLaunch.Checked; + weapon.FireOnGround = this.selFireOnGround.Checked; + } + public void LoadWeaponData(WeaponContainer weapon) + { + + // Read general settings + this.selName.Text = weapon.Name.Value; + this.selDetonation.SelectedIndex = (int)weapon.DetonationType; + this.selType.SelectedIndex = (int)weapon.ProjectileLaunchType; + this.selRetreatTime.Value = weapon.RetreatTime; + this.selFuseTime.Value = weapon.FuseTime; + + // Read power settings + this.selWormDmgRad.Value = weapon.WormDamageRadius; + this.selWormDmgMag.Value = weapon.WormDamageMagnitude; + this.selLandDmgRad.Value = weapon.LandDamageRadius; + this.selBlastDmgRad.Value = weapon.Push; + this.selMaxThrowStr.Value = weapon.ProjectileMaxPower; + + // Read clusters + + this.selNumCluster.Value = weapon.ProjectileNumClusters; + this.selClusterSpread.Value = weapon.ClusterSpread; + this.selClusterMaxSpeed.Value = weapon.ClusterMaxSpeed; + + // Read technical + + this.selPayloadId.Value = weapon.PayloadResourceId; + this.selCollisionRad.Value = weapon.ProjectileCollisionRadius; + this.selLaunchFx.Text = weapon.LaunchFX.Value; + this.selArielFx.Text = weapon.ArielFX.Value; + this.selDetonationFx.Text = weapon.DetonationFX.Value; + + selGraphicalLocators.Clear(); + selGraphicalResoures.Clear(); + + foreach(XomString graphicalRes in weapon.GraphicalResources) + this.selGraphicalResoures.AddItem(graphicalRes.Value); + + foreach (XomString graphicalLoc in weapon.GraphicalLocators) + this.selGraphicalLocators.AddItem(graphicalLoc.Value); + + // Read toggles + + this.selHoming.Checked = weapon.Homing; + this.selAdvancedHoming.Checked = weapon.HomingAvoidLand; + this.selPoison.Checked = weapon.Poison; + this.selWindEffected.Checked = weapon.EffectedByWind; + this.selPowerUpLaunch.Checked = weapon.ProjectilePowersUp; + this.selFireOnGround.Checked = weapon.FireOnGround; + } + + public WeaponsPanel() + { + InitializeComponent(); + + } + } +} diff --git a/W4Gui/WeaponsPanel.resx b/W4Gui/WeaponsPanel.resx new file mode 100644 index 0000000..4151b51 --- /dev/null +++ b/W4Gui/WeaponsPanel.resx @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + * By default, Worm DMG, Land DMG, Blast DMG and Throw Strength will always be a number between 0.0 and 1.0. numbers higher than this will do increased damage, +however it could lag a bit. + +* Worm DMG Radius normally cannot even be adjusted. and is by default a constant "0.75" + + + + + * By default, Cluster Spread, and Cluster Max Speed +are a value between 0.0 and 1.0, +higher numbers will result in much larger spread of speeds. + +* Normally, number of clusters, cannot go above 10. +higher numbers will work, but if you go too high, your game will crash + +* On Air Strike weapons, the "Number of Clusters" field is used +for the number of bombs in the airstrike, + + + + \ No newline at end of file diff --git a/Worms4Editor.sln b/Worms4Editor.sln index ff6473e..0e86caf 100644 --- a/Worms4Editor.sln +++ b/Worms4Editor.sln @@ -3,11 +3,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.4.33205.214 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Worms4Editor", "Worms4Editor\Worms4Editor.csproj", "{FBAA43A5-824F-4C9A-97BC-7B18A42413B9}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibXom", "LibXom\LibXom.csproj", "{7B60E17C-780E-44D3-BF02-9F5712DD3AE2}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibW4M", "LibW4M\LibW4M.csproj", "{ABA3728B-4745-4622-B140-A82C07AF4992}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LibW4M", "LibW4M\LibW4M.csproj", "{ABA3728B-4745-4622-B140-A82C07AF4992}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "W4Gui", "W4Gui\W4Gui.csproj", "{80F28B66-98AF-4A93-BD2C-05024D619C30}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -15,10 +15,6 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {FBAA43A5-824F-4C9A-97BC-7B18A42413B9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FBAA43A5-824F-4C9A-97BC-7B18A42413B9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FBAA43A5-824F-4C9A-97BC-7B18A42413B9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FBAA43A5-824F-4C9A-97BC-7B18A42413B9}.Release|Any CPU.Build.0 = Release|Any CPU {7B60E17C-780E-44D3-BF02-9F5712DD3AE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7B60E17C-780E-44D3-BF02-9F5712DD3AE2}.Debug|Any CPU.Build.0 = Debug|Any CPU {7B60E17C-780E-44D3-BF02-9F5712DD3AE2}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -27,6 +23,10 @@ Global {ABA3728B-4745-4622-B140-A82C07AF4992}.Debug|Any CPU.Build.0 = Debug|Any CPU {ABA3728B-4745-4622-B140-A82C07AF4992}.Release|Any CPU.ActiveCfg = Release|Any CPU {ABA3728B-4745-4622-B140-A82C07AF4992}.Release|Any CPU.Build.0 = Release|Any CPU + {80F28B66-98AF-4A93-BD2C-05024D619C30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {80F28B66-98AF-4A93-BD2C-05024D619C30}.Debug|Any CPU.Build.0 = Debug|Any CPU + {80F28B66-98AF-4A93-BD2C-05024D619C30}.Release|Any CPU.ActiveCfg = Release|Any CPU + {80F28B66-98AF-4A93-BD2C-05024D619C30}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Worms4Editor/Program.cs b/Worms4Editor/Program.cs deleted file mode 100644 index 614d8f9..0000000 --- a/Worms4Editor/Program.cs +++ /dev/null @@ -1,31 +0,0 @@ -using LibXom; -using LibXom.Blocks; -using LibXom.Data; -using System.Security.Cryptography; -using System.Text; - -namespace Worms4Editor -{ - internal class Program - { - static void Main(string[] args) - { - XomFile xfile = XomReader.ReadXomFile(@"SaveGame.xom"); - - foreach(XomType type in xfile.XomTypes) - { - Console.WriteLine(type.Name); - - if (Directory.Exists(type.Name)) Directory.Delete(type.Name, true); - - Directory.CreateDirectory(type.Name); - foreach(XomContainer container in type.Containers) - { - string name = Path.Combine(type.Name, container.Id.ToString("X") + ".bin"); - File.WriteAllBytes(name, container.GetData()); - } - } - - } - } -} \ No newline at end of file diff --git a/Worms4Editor/Worms4Editor.csproj b/Worms4Editor/Worms4Editor.csproj deleted file mode 100644 index ea5db42..0000000 --- a/Worms4Editor/Worms4Editor.csproj +++ /dev/null @@ -1,14 +0,0 @@ - - - - Exe - net7.0 - enable - enable - - - - - - -