mirror of
https://gitlab.com/Syroot/Worms.git
synced 2025-03-04 09:25:22 +03:00
Use BinaryData 2.0.0 RC to load ProjectX data more automatically.
This commit is contained in:
parent
5e23aef58c
commit
ff042f1fc2
@ -1,6 +1,3 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using Syroot.Worms.Gen2.Armageddon.ProjectX;
|
||||
|
||||
namespace Syroot.Worms.Test
|
||||
@ -14,13 +11,8 @@ namespace Syroot.Worms.Test
|
||||
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
Library library = new Library(@"D:\Archive\Games\Worms\Worms Armageddon\3.6.31.0\Libs\cnades.pxl");
|
||||
Library library = new Library(@"D:\Pictures\loadme.pxl");
|
||||
library.Save(@"D:\Pictures\saved.pxl");
|
||||
|
||||
//Scheme pxScheme = new Scheme(@"D:\Archive\Games\Worms\Worms Armageddon\3.6.31.0\PXSchemes\PacStruction.pxs");
|
||||
|
||||
Console.WriteLine("Done.");
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@ using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using Syroot.IO;
|
||||
using Syroot.BinaryData;
|
||||
|
||||
namespace Syroot.Worms.Core
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using Syroot.IO;
|
||||
using Syroot.BinaryData;
|
||||
|
||||
namespace Syroot.Worms.Core
|
||||
{
|
||||
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.BinaryData;
|
||||
|
||||
namespace Syroot.Worms.Core
|
||||
{
|
||||
|
@ -2,7 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.BinaryData;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.BinaryData;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.BinaryData;
|
||||
using Syroot.Maths;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
|
@ -1,22 +0,0 @@
|
||||
using System.IO;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public abstract class ActionBase : ILoadable, ISaveable
|
||||
{
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public abstract void Load(Stream stream);
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public abstract void Save(Stream stream);
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using Syroot.BinaryData;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
internal class ActionConverter : IBinaryConverter
|
||||
{
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
public object Read(BinaryDataReader reader, object instance, BinaryMemberAttribute memberAttribute)
|
||||
{
|
||||
ExplosionAction explosionAction;
|
||||
switch (instance)
|
||||
{
|
||||
case LauncherStyle launcherStyle:
|
||||
explosionAction = launcherStyle.ExplosionAction;
|
||||
break;
|
||||
case ClusterTarget clusterTarget:
|
||||
explosionAction = clusterTarget.ExplosionAction;
|
||||
break;
|
||||
default:
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
switch (explosionAction)
|
||||
{
|
||||
case ExplosionAction.Bounce:
|
||||
return reader.ReadObject<BounceAction>();
|
||||
case ExplosionAction.Dig:
|
||||
return reader.ReadObject<DigAction>();
|
||||
case ExplosionAction.Home:
|
||||
return reader.ReadObject<HomeAction>();
|
||||
case ExplosionAction.Roam:
|
||||
return reader.ReadObject<RoamAction>();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void Write(BinaryDataWriter writer, object instance, BinaryMemberAttribute memberAttribute, object value)
|
||||
{
|
||||
writer.WriteObject(value);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,6 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public class BounceAction : ActionBase
|
||||
public class BounceAction : IAction
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
@ -29,51 +25,5 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
public int DamageRandomness { get; set; }
|
||||
|
||||
public int BounceCount { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public override void Load(Stream stream)
|
||||
{
|
||||
using (BinaryDataReader reader = new BinaryDataReader(stream, Encoding.ASCII, true))
|
||||
{
|
||||
Collisions = reader.ReadEnum<CollisionFlags>(false);
|
||||
Bounciness = reader.ReadInt32();
|
||||
Acceleration = reader.ReadInt32();
|
||||
Sound = reader.ReadInt32();
|
||||
Unknown1 = reader.ReadInt32();
|
||||
Unknown2 = reader.ReadInt32();
|
||||
ExplosionBias = reader.ReadInt32();
|
||||
ExplosionPower = reader.ReadInt32();
|
||||
ExplosionDamage = reader.ReadInt32();
|
||||
DamageRandomness = reader.ReadInt32();
|
||||
BounceCount = reader.ReadInt32();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public override void Save(Stream stream)
|
||||
{
|
||||
using (BinaryDataWriter writer = new BinaryDataWriter(stream, Encoding.ASCII, true))
|
||||
{
|
||||
writer.Write(Collisions, true);
|
||||
writer.Write(Bounciness);
|
||||
writer.Write(Acceleration);
|
||||
writer.Write(Sound);
|
||||
writer.Write(Unknown1);
|
||||
writer.Write(Unknown2);
|
||||
writer.Write(ExplosionBias);
|
||||
writer.Write(ExplosionPower);
|
||||
writer.Write(ExplosionDamage);
|
||||
writer.Write(DamageRandomness);
|
||||
writer.Write(BounceCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,6 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public class DigAction : ActionBase
|
||||
public class DigAction : IAction
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
@ -21,43 +17,5 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
public int Sprite2 { get; set; }
|
||||
|
||||
public int Sprite3 { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public override void Load(Stream stream)
|
||||
{
|
||||
using (BinaryDataReader reader = new BinaryDataReader(stream, Encoding.ASCII, true))
|
||||
{
|
||||
Unknown1 = reader.ReadInt32();
|
||||
Unknown2 = reader.ReadInt32();
|
||||
DiggingSound = reader.ReadInt32();
|
||||
SpriteJumping = reader.ReadInt32();
|
||||
Sprite1 = reader.ReadInt32();
|
||||
Sprite2 = reader.ReadInt32();
|
||||
Sprite3 = reader.ReadInt32();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public override void Save(Stream stream)
|
||||
{
|
||||
using (BinaryDataWriter writer = new BinaryDataWriter(stream, Encoding.ASCII, true))
|
||||
{
|
||||
writer.Write(Unknown1);
|
||||
writer.Write(Unknown2);
|
||||
writer.Write(DiggingSound);
|
||||
writer.Write(SpriteJumping);
|
||||
writer.Write(Sprite1);
|
||||
writer.Write(Sprite2);
|
||||
writer.Write(Sprite3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,12 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.Worms.Core;
|
||||
using Syroot.BinaryData;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public class HomeAction : ActionBase
|
||||
public class HomeAction : IAction
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
[BinaryMember(Offset = 4)]
|
||||
public Sprite Sprite { get; set; }
|
||||
|
||||
public HomeStyle HomeStyle { get; set; }
|
||||
@ -16,40 +14,6 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
public int Delay { get; set; }
|
||||
|
||||
public int Duration { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public override void Load(Stream stream)
|
||||
{
|
||||
using (BinaryDataReader reader = new BinaryDataReader(stream, Encoding.ASCII, true))
|
||||
{
|
||||
reader.Seek(4);
|
||||
Sprite = reader.ReadStruct<Sprite>();
|
||||
HomeStyle = reader.ReadEnum<HomeStyle>(false);
|
||||
Delay = reader.ReadInt32();
|
||||
Duration = reader.ReadInt32();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public override void Save(Stream stream)
|
||||
{
|
||||
using (BinaryDataWriter writer = new BinaryDataWriter(stream, Encoding.ASCII, true))
|
||||
{
|
||||
writer.Write(0);
|
||||
writer.Write(Sprite);
|
||||
writer.Write(HomeStyle);
|
||||
writer.Write(Delay);
|
||||
writer.Write(Duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum HomeStyle
|
||||
|
@ -0,0 +1,6 @@
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public interface IAction
|
||||
{
|
||||
}
|
||||
}
|
@ -1,10 +1,8 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.BinaryData;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public class RoamAction : ActionBase
|
||||
public class RoamAction : IAction
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
@ -30,6 +28,7 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
|
||||
public int TerrainOffset { get; set; }
|
||||
|
||||
[BinaryMember(BooleanFormat = BinaryBooleanFormat.NonZeroDword)]
|
||||
public bool Fart { get; set; }
|
||||
|
||||
public int DiseasePower { get; set; }
|
||||
@ -43,65 +42,5 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
public int SpriteTakeOff { get; set; }
|
||||
|
||||
public int SpriteDuringFlight { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public override void Load(Stream stream)
|
||||
{
|
||||
using (BinaryDataReader reader = new BinaryDataReader(stream, Encoding.ASCII, true))
|
||||
{
|
||||
RoamCollisions = reader.ReadEnum<CollisionFlags>(false);
|
||||
ExplosionCollisions = reader.ReadEnum<CollisionFlags>(false);
|
||||
WalkSpeed = reader.ReadInt32();
|
||||
Unknown = reader.ReadInt32();
|
||||
JumpAngleEdge = reader.ReadInt32();
|
||||
JumpVelocityEdge = reader.ReadInt32();
|
||||
JumpSoundEdge = reader.ReadInt32();
|
||||
JumpAngle = reader.ReadInt32();
|
||||
JumpVelocity = reader.ReadInt32();
|
||||
JumpSound = reader.ReadInt32();
|
||||
TerrainOffset = reader.ReadInt32();
|
||||
Fart = reader.ReadBoolean(BinaryBooleanFormat.NonZeroDword);
|
||||
DiseasePower = reader.ReadInt32();
|
||||
SpriteFarting = reader.ReadInt32();
|
||||
SpriteFlying = reader.ReadInt32();
|
||||
SpriteFlying2 = reader.ReadInt32();
|
||||
SpriteTakeOff = reader.ReadInt32();
|
||||
SpriteDuringFlight = reader.ReadInt32();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public override void Save(Stream stream)
|
||||
{
|
||||
using (BinaryDataWriter writer = new BinaryDataWriter(stream, Encoding.ASCII, true))
|
||||
{
|
||||
writer.Write(RoamCollisions, true);
|
||||
writer.Write(ExplosionCollisions, true);
|
||||
writer.Write(WalkSpeed);
|
||||
writer.Write(Unknown);
|
||||
writer.Write(JumpAngleEdge);
|
||||
writer.Write(JumpVelocityEdge);
|
||||
writer.Write(JumpSoundEdge);
|
||||
writer.Write(JumpAngle);
|
||||
writer.Write(JumpVelocity);
|
||||
writer.Write(JumpSound);
|
||||
writer.Write(TerrainOffset);
|
||||
writer.Write(Fart, BinaryBooleanFormat.NonZeroDword);
|
||||
writer.Write(DiseasePower);
|
||||
writer.Write(SpriteFarting);
|
||||
writer.Write(SpriteFlying);
|
||||
writer.Write(SpriteFlying2);
|
||||
writer.Write(SpriteTakeOff);
|
||||
writer.Write(SpriteDuringFlight);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using Syroot.IO;
|
||||
using Syroot.BinaryData;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
|
@ -4,7 +4,7 @@ using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.BinaryData;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
|
@ -2,7 +2,6 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Mine
|
||||
{
|
||||
public int Sensitivity;
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.BinaryData;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
|
@ -1,25 +1,19 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using Syroot.BinaryData;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct Sound
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public short SoundIndex;
|
||||
|
||||
// One byte goes unused here as marshalling does not support 2-byte booleans.
|
||||
|
||||
[FieldOffset(3)]
|
||||
[BinaryMember(BooleanFormat = BinaryBooleanFormat.NonZeroWord)]
|
||||
public bool RepeatSound;
|
||||
|
||||
[FieldOffset(4)]
|
||||
[BinaryMember(BooleanFormat = BinaryBooleanFormat.NonZeroDword)]
|
||||
public bool UseExplosionSound;
|
||||
|
||||
[FieldOffset(8)]
|
||||
public int SoundBeforeExplosion;
|
||||
|
||||
[FieldOffset(12)]
|
||||
public int DelayBeforeExplosion;
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Sprite
|
||||
{
|
||||
public int SpriteNumber;
|
||||
|
@ -1,12 +1,8 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.Worms.Core;
|
||||
using Syroot.BinaryData;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public class AirstrikeStyle : StyleBase
|
||||
public class AirstrikeStyle : IStyle
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
@ -20,63 +16,13 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
|
||||
public int Sound;
|
||||
|
||||
public WeaponAirstrikeAction Action;
|
||||
public WeaponAirstrikeSubstyle AirstrikeSubstyle;
|
||||
|
||||
public StyleBase Style;
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public override void Load(Stream stream)
|
||||
{
|
||||
using (BinaryDataReader reader = new BinaryDataReader(stream, Encoding.ASCII, true))
|
||||
{
|
||||
PlaneSprite = reader.ReadInt32();
|
||||
BombsCount = reader.ReadInt32();
|
||||
DropDistance = reader.ReadInt32();
|
||||
HorizontalSpeed = reader.ReadInt32();
|
||||
Sound = reader.ReadInt32();
|
||||
|
||||
Action = reader.ReadEnum<WeaponAirstrikeAction>(false);
|
||||
switch (Action)
|
||||
{
|
||||
case WeaponAirstrikeAction.Launcher:
|
||||
Style = reader.Load<LauncherStyle>();
|
||||
break;
|
||||
case WeaponAirstrikeAction.Mines:
|
||||
Style = reader.Load<MineStyle>();
|
||||
break;
|
||||
}
|
||||
}
|
||||
[BinaryMember(Converter = typeof(AirstrikeSubstyleConverter))]
|
||||
public IStyle Style;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public override void Save(Stream stream)
|
||||
{
|
||||
using (BinaryDataWriter writer = new BinaryDataWriter(stream, Encoding.ASCII, true))
|
||||
{
|
||||
writer.Write(PlaneSprite);
|
||||
writer.Write(BombsCount);
|
||||
writer.Write(DropDistance);
|
||||
writer.Write(HorizontalSpeed);
|
||||
writer.Write(Sound);
|
||||
|
||||
writer.Write(Action, true);
|
||||
if (Action != WeaponAirstrikeAction.Worms)
|
||||
{
|
||||
writer.Save(Style);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum WeaponAirstrikeAction : int
|
||||
public enum WeaponAirstrikeSubstyle : int
|
||||
{
|
||||
Mines,
|
||||
Worms,
|
||||
|
@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using Syroot.BinaryData;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public class AirstrikeSubstyleConverter : IBinaryConverter
|
||||
{
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
public object Read(BinaryDataReader reader, object instance, BinaryMemberAttribute memberAttribute)
|
||||
{
|
||||
WeaponAirstrikeSubstyle airstrikeSubstyle;
|
||||
switch (instance)
|
||||
{
|
||||
case AirstrikeStyle airstrikeStyle:
|
||||
airstrikeSubstyle = airstrikeStyle.AirstrikeSubstyle;
|
||||
break;
|
||||
default:
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
switch (airstrikeSubstyle)
|
||||
{
|
||||
case WeaponAirstrikeSubstyle.Launcher:
|
||||
return reader.ReadObject<LauncherStyle>();
|
||||
case WeaponAirstrikeSubstyle.Mines:
|
||||
return reader.ReadObject<MineStyle>();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void Write(BinaryDataWriter writer, object instance, BinaryMemberAttribute memberAttribute, object value)
|
||||
{
|
||||
writer.WriteObject(value);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,45 +1,11 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public class BaseballBatStyle : StyleBase
|
||||
public class BaseballBatStyle : IStyle
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
public int Damage { get; set; }
|
||||
|
||||
public int PushPower { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public override void Load(Stream stream)
|
||||
{
|
||||
using (BinaryDataReader reader = new BinaryDataReader(stream, Encoding.ASCII, true))
|
||||
{
|
||||
Damage = reader.ReadInt32();
|
||||
PushPower = reader.ReadInt32();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public override void Save(Stream stream)
|
||||
{
|
||||
using (BinaryDataWriter writer = new BinaryDataWriter(stream, Encoding.ASCII, true))
|
||||
{
|
||||
writer.Write(Damage);
|
||||
writer.Write(PushPower);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,41 +1,9 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public class BattleAxeStyle : StyleBase
|
||||
public class BattleAxeStyle : IStyle
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
public int PercentualDamage { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public override void Load(Stream stream)
|
||||
{
|
||||
using (BinaryDataReader reader = new BinaryDataReader(stream, Encoding.ASCII, true))
|
||||
{
|
||||
PercentualDamage = reader.ReadInt32();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public override void Save(Stream stream)
|
||||
{
|
||||
using (BinaryDataWriter writer = new BinaryDataWriter(stream, Encoding.ASCII, true))
|
||||
{
|
||||
writer.Write(PercentualDamage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public class BlowtorchStyle : StyleBase
|
||||
public class BlowtorchStyle : IStyle
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
@ -17,37 +11,5 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
public int ImpactAngle { get; set; }
|
||||
|
||||
public int TunellingTime { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public override void Load(Stream stream)
|
||||
{
|
||||
using (BinaryDataReader reader = new BinaryDataReader(stream, Encoding.ASCII, true))
|
||||
{
|
||||
Damage = reader.ReadInt32();
|
||||
PushPower = reader.ReadInt32();
|
||||
ImpactAngle = reader.ReadInt32();
|
||||
TunellingTime = reader.ReadInt32();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public override void Save(Stream stream)
|
||||
{
|
||||
using (BinaryDataWriter writer = new BinaryDataWriter(stream, Encoding.ASCII, true))
|
||||
{
|
||||
writer.Write(Damage);
|
||||
writer.Write(PushPower);
|
||||
writer.Write(ImpactAngle);
|
||||
writer.Write(TunellingTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,39 +1,9 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public class BowStyle : StyleBase
|
||||
public class BowStyle : IStyle
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
public int Damage { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public override void Load(Stream stream)
|
||||
{
|
||||
using (BinaryDataReader reader = new BinaryDataReader(stream, Encoding.ASCII, true))
|
||||
{
|
||||
Damage = reader.ReadInt32();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public override void Save(Stream stream)
|
||||
{
|
||||
using (BinaryDataWriter writer = new BinaryDataWriter(stream, Encoding.ASCII, true))
|
||||
{
|
||||
writer.Write(Damage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,6 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public class CanisterStyle : StyleBase
|
||||
public class CanisterStyle : IStyle
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
@ -15,37 +11,5 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
public int DiseasePoints { get; set; }
|
||||
|
||||
public int MaxDamage { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public override void Load(Stream stream)
|
||||
{
|
||||
using (BinaryDataReader reader = new BinaryDataReader(stream, Encoding.ASCII, true))
|
||||
{
|
||||
SpriteInactive = reader.ReadInt32();
|
||||
SpriteActive = reader.ReadInt32();
|
||||
DiseasePoints = reader.ReadInt32();
|
||||
MaxDamage = reader.ReadInt32();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public override void Save(Stream stream)
|
||||
{
|
||||
using (BinaryDataWriter writer = new BinaryDataWriter(stream, Encoding.ASCII, true))
|
||||
{
|
||||
writer.Write(SpriteInactive);
|
||||
writer.Write(SpriteActive);
|
||||
writer.Write(DiseasePoints);
|
||||
writer.Write(MaxDamage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public class DragonballStyle : StyleBase
|
||||
public class DragonballStyle : IStyle
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
@ -23,43 +17,5 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
public int Force { get; set; }
|
||||
|
||||
public int BallTime { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public override void Load(Stream stream)
|
||||
{
|
||||
using (BinaryDataReader reader = new BinaryDataReader(stream, Encoding.ASCII, true))
|
||||
{
|
||||
FiringSound = reader.ReadInt32();
|
||||
ImpactSound = reader.ReadInt32();
|
||||
BallSprite = reader.ReadInt32();
|
||||
Damage = reader.ReadInt32();
|
||||
Angle = reader.ReadInt32();
|
||||
Force = reader.ReadInt32();
|
||||
BallTime = reader.ReadInt32();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public override void Save(Stream stream)
|
||||
{
|
||||
using (BinaryDataWriter writer = new BinaryDataWriter(stream, Encoding.ASCII, true))
|
||||
{
|
||||
writer.Write(FiringSound);
|
||||
writer.Write(ImpactSound);
|
||||
writer.Write(BallSprite);
|
||||
writer.Write(Damage);
|
||||
writer.Write(Angle);
|
||||
writer.Write(Force);
|
||||
writer.Write(BallTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,6 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public class FirepunchStyle : StyleBase
|
||||
public class FirepunchStyle : IStyle
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
@ -15,37 +11,5 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
public int PushPower { get; set; }
|
||||
|
||||
public int JumpHeight { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public override void Load(Stream stream)
|
||||
{
|
||||
using (BinaryDataReader reader = new BinaryDataReader(stream, Encoding.ASCII, true))
|
||||
{
|
||||
Damage = reader.ReadInt32();
|
||||
Angle = reader.ReadInt32();
|
||||
PushPower = reader.ReadInt32();
|
||||
JumpHeight = reader.ReadInt32();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public override void Save(Stream stream)
|
||||
{
|
||||
using (BinaryDataWriter writer = new BinaryDataWriter(stream, Encoding.ASCII, true))
|
||||
{
|
||||
writer.Write(Damage);
|
||||
writer.Write(Angle);
|
||||
writer.Write(PushPower);
|
||||
writer.Write(JumpHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,8 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.BinaryData;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public class FlamethrowerStyle : StyleBase
|
||||
public class FlamethrowerStyle : IStyle
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
@ -16,40 +14,7 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
|
||||
public int FireBurnTime { get; set; }
|
||||
|
||||
[BinaryMember(BooleanFormat = BinaryBooleanFormat.NonZeroDword)]
|
||||
public bool RemainOnTerrain { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public override void Load(Stream stream)
|
||||
{
|
||||
using (BinaryDataReader reader = new BinaryDataReader(stream, Encoding.ASCII, true))
|
||||
{
|
||||
FuelAmount = reader.ReadInt32();
|
||||
FireIntensity = reader.ReadInt32();
|
||||
FireAmount = reader.ReadInt32();
|
||||
FireBurnTime = reader.ReadInt32();
|
||||
RemainOnTerrain = reader.ReadBoolean(BinaryBooleanFormat.NonZeroDword);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public override void Save(Stream stream)
|
||||
{
|
||||
using (BinaryDataWriter writer = new BinaryDataWriter(stream, Encoding.ASCII, true))
|
||||
{
|
||||
writer.Write(FuelAmount);
|
||||
writer.Write(FireIntensity);
|
||||
writer.Write(FireAmount);
|
||||
writer.Write(FireBurnTime);
|
||||
writer.Write(RemainOnTerrain, BinaryBooleanFormat.NonZeroDword);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,6 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public class GunStyle : StyleBase
|
||||
public class GunStyle : IStyle
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
@ -36,57 +31,5 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
public int Range2 { get; set; }
|
||||
|
||||
public int Range3 { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public override void Load(Stream stream)
|
||||
{
|
||||
using (BinaryDataReader reader = new BinaryDataReader(stream, Encoding.ASCII, true))
|
||||
{
|
||||
BulletCount = reader.ReadInt32();
|
||||
ReloadTime = reader.ReadInt32();
|
||||
BulletSpread = reader.ReadInt32();
|
||||
Burst = reader.ReadInt32();
|
||||
BurstSpread = reader.ReadInt32();
|
||||
Collisions = reader.ReadEnum<CollisionFlags>(false);
|
||||
ExplosionBias = reader.ReadInt32();
|
||||
ExplosionPower = reader.ReadInt32();
|
||||
MaxDamage = reader.ReadInt32();
|
||||
DamageSpread = reader.ReadInt32();
|
||||
ExpEffect = reader.ReadInt32();
|
||||
Range1 = reader.ReadInt32();
|
||||
Range2 = reader.ReadInt32();
|
||||
Range3 = reader.ReadInt32();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public override void Save(Stream stream)
|
||||
{
|
||||
using (BinaryDataWriter writer = new BinaryDataWriter(stream, Encoding.ASCII, true))
|
||||
{
|
||||
writer.Write(BulletCount);
|
||||
writer.Write(ReloadTime);
|
||||
writer.Write(BulletSpread);
|
||||
writer.Write(Burst);
|
||||
writer.Write(BurstSpread);
|
||||
writer.Write(Collisions, true);
|
||||
writer.Write(ExplosionBias);
|
||||
writer.Write(ExplosionPower);
|
||||
writer.Write(MaxDamage);
|
||||
writer.Write(DamageSpread);
|
||||
writer.Write(ExpEffect);
|
||||
writer.Write(Range1);
|
||||
writer.Write(Range2);
|
||||
writer.Write(Range3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public interface IStyle
|
||||
{
|
||||
}
|
||||
}
|
@ -1,41 +1,9 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public class JetpackStyle : StyleBase
|
||||
public class JetpackStyle : IStyle
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
public int Fuel { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public override void Load(Stream stream)
|
||||
{
|
||||
using (BinaryDataReader reader = new BinaryDataReader(stream, Encoding.ASCII, true))
|
||||
{
|
||||
Fuel = reader.ReadInt32();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public override void Save(Stream stream)
|
||||
{
|
||||
using (BinaryDataWriter writer = new BinaryDataWriter(stream, Encoding.ASCII, true))
|
||||
{
|
||||
writer.Write(Fuel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public class KamikazeStyle : StyleBase
|
||||
public class KamikazeStyle : IStyle
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
@ -21,41 +15,5 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
public int ImpactForce { get; set; }
|
||||
|
||||
public int ImpactAngle { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public override void Load(Stream stream)
|
||||
{
|
||||
using (BinaryDataReader reader = new BinaryDataReader(stream, Encoding.ASCII, true))
|
||||
{
|
||||
FlyingTime = reader.ReadInt32();
|
||||
ExplosionDamage = reader.ReadInt32();
|
||||
FireSound = reader.ReadInt32();
|
||||
Damage = reader.ReadInt32();
|
||||
ImpactForce = reader.ReadInt32();
|
||||
ImpactAngle = reader.ReadInt32();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public override void Save(Stream stream)
|
||||
{
|
||||
using (BinaryDataWriter writer = new BinaryDataWriter(stream, Encoding.ASCII, true))
|
||||
{
|
||||
writer.Write(FlyingTime);
|
||||
writer.Write(ExplosionDamage);
|
||||
writer.Write(FireSound);
|
||||
writer.Write(Damage);
|
||||
writer.Write(ImpactForce);
|
||||
writer.Write(ImpactAngle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +1,8 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.Worms.Core;
|
||||
using Syroot.BinaryData;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public class LauncherStyle : StyleBase
|
||||
public class LauncherStyle : IStyle
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
@ -14,6 +10,7 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
|
||||
public int FixedSpeed { get; set; }
|
||||
|
||||
[BinaryMember(BooleanFormat = BinaryBooleanFormat.NonZeroDword)]
|
||||
public bool RunAway { get; set; }
|
||||
|
||||
public CollisionFlags Collisions { get; set; }
|
||||
@ -44,120 +41,19 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
|
||||
public Sound Sound { get; set; }
|
||||
|
||||
[BinaryMember(BooleanFormat = BinaryBooleanFormat.NonZeroDword)]
|
||||
public bool ExplodeOnSpace { get; set; }
|
||||
|
||||
public ExplosionAction ExplosionAction { get; set; }
|
||||
|
||||
public ActionBase Action { get; set; }
|
||||
[BinaryMember(Converter = typeof(ActionConverter))]
|
||||
public IAction Action { get; set; }
|
||||
|
||||
[BinaryMember(OffsetOrigin = OffsetOrigin.Begin, Offset = 180)]
|
||||
public ExplosionTarget ExplosionTarget { get; set; }
|
||||
|
||||
public TargetBase Target { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public override void Load(Stream stream)
|
||||
{
|
||||
using (BinaryDataReader reader = new BinaryDataReader(stream, Encoding.ASCII, true))
|
||||
{
|
||||
long offset = reader.Position;
|
||||
|
||||
SpriteSize = reader.ReadInt32();
|
||||
FixedSpeed = reader.ReadInt32();
|
||||
RunAway = reader.ReadBoolean(BinaryBooleanFormat.NonZeroDword);
|
||||
Collisions = reader.ReadEnum<CollisionFlags>(false);
|
||||
ExplosionBias = reader.ReadInt32();
|
||||
ExplosionPushPower = reader.ReadInt32();
|
||||
ExplosionDamage = reader.ReadInt32();
|
||||
ExplosionDamageVariation = reader.ReadInt32();
|
||||
ExplosionUnknown = reader.ReadInt32();
|
||||
Sprite = reader.ReadStruct<Sprite>();
|
||||
VariableSpeed = reader.ReadInt32();
|
||||
WindFactor = reader.ReadInt32();
|
||||
MotionRandomness = reader.ReadInt32();
|
||||
GravityFactor = reader.ReadInt32();
|
||||
ExplosionCountdown = reader.ReadInt32();
|
||||
ExplosionTimer = reader.ReadInt32();
|
||||
Sound = reader.ReadStruct<Sound>();
|
||||
ExplodeOnSpace = reader.ReadBoolean(BinaryBooleanFormat.NonZeroDword);
|
||||
|
||||
ExplosionAction = reader.ReadEnum<ExplosionAction>(false);
|
||||
switch (ExplosionAction)
|
||||
{
|
||||
case ExplosionAction.Bounce:
|
||||
Action = reader.Load<BounceAction>();
|
||||
break;
|
||||
case ExplosionAction.Dig:
|
||||
Action = reader.Load<DigAction>();
|
||||
break;
|
||||
case ExplosionAction.Home:
|
||||
Action = reader.Load<HomeAction>();
|
||||
break;
|
||||
case ExplosionAction.Roam:
|
||||
Action = reader.Load<RoamAction>();
|
||||
break;
|
||||
}
|
||||
|
||||
reader.Position = offset + 180;
|
||||
ExplosionTarget = reader.ReadEnum<ExplosionTarget>(false);
|
||||
reader.Seek(sizeof(int));
|
||||
switch (ExplosionTarget)
|
||||
{
|
||||
case ExplosionTarget.Clusters:
|
||||
Target = reader.Load<ClusterTarget>();
|
||||
break;
|
||||
case ExplosionTarget.Fire:
|
||||
Target = reader.Load<FireTarget>();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public override void Save(Stream stream)
|
||||
{
|
||||
using (BinaryDataWriter writer = new BinaryDataWriter(stream, Encoding.ASCII, true))
|
||||
{
|
||||
long offset = writer.Position;
|
||||
|
||||
writer.Write(SpriteSize);
|
||||
writer.Write(FixedSpeed);
|
||||
writer.Write(RunAway, BinaryBooleanFormat.NonZeroDword);
|
||||
writer.Write(Collisions, true);
|
||||
writer.Write(ExplosionBias);
|
||||
writer.Write(ExplosionPushPower);
|
||||
writer.Write(ExplosionDamage);
|
||||
writer.Write(ExplosionDamageVariation);
|
||||
writer.Write(ExplosionUnknown);
|
||||
writer.Write(Sprite);
|
||||
writer.Write(VariableSpeed);
|
||||
writer.Write(WindFactor);
|
||||
writer.Write(MotionRandomness);
|
||||
writer.Write(GravityFactor);
|
||||
writer.Write(ExplosionCountdown);
|
||||
writer.Write(ExplosionTimer);
|
||||
writer.Write(Sound);
|
||||
writer.Write(ExplodeOnSpace, BinaryBooleanFormat.NonZeroDword);
|
||||
|
||||
writer.Write(ExplosionAction, true);
|
||||
writer.Save(Action);
|
||||
|
||||
writer.Position = offset + 180;
|
||||
writer.Write(ExplosionTarget, true);
|
||||
writer.Seek(sizeof(int));
|
||||
if (ExplosionTarget != ExplosionTarget.None)
|
||||
{
|
||||
writer.Save(Target);
|
||||
}
|
||||
}
|
||||
}
|
||||
[BinaryMember(Offset = sizeof(int), Converter = typeof(TargetConverter))]
|
||||
public ITarget Target { get; set; }
|
||||
}
|
||||
|
||||
public enum ExplosionAction : int
|
||||
|
@ -1,40 +1,9 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public class MineStyle : StyleBase
|
||||
public class MineStyle : IStyle
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
public Mine Mine;
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public override void Load(Stream stream)
|
||||
{
|
||||
using (BinaryDataReader reader = new BinaryDataReader(stream, Encoding.ASCII, true))
|
||||
{
|
||||
Mine = reader.ReadStruct<Mine>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public override void Save(Stream stream)
|
||||
{
|
||||
using (BinaryDataWriter writer = new BinaryDataWriter(stream, Encoding.ASCII, true))
|
||||
{
|
||||
writer.Write(Mine);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public class NinjaRopeStyle : StyleBase
|
||||
public class NinjaRopeStyle : IStyle
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
@ -15,35 +9,5 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
public int Length { get; set; }
|
||||
|
||||
public int AngleRestriction { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public override void Load(Stream stream)
|
||||
{
|
||||
using (BinaryDataReader reader = new BinaryDataReader(stream, Encoding.ASCII, true))
|
||||
{
|
||||
ShotCount = reader.ReadInt32();
|
||||
Length = reader.ReadInt32();
|
||||
AngleRestriction = reader.ReadInt32();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public override void Save(Stream stream)
|
||||
{
|
||||
using (BinaryDataWriter writer = new BinaryDataWriter(stream, Encoding.ASCII, true))
|
||||
{
|
||||
writer.Write(ShotCount);
|
||||
writer.Write(Length);
|
||||
writer.Write(AngleRestriction);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,45 +1,11 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public class NuclearTestStyle : StyleBase
|
||||
public class NuclearTestStyle : IStyle
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
public int WaterRise { get; set; }
|
||||
|
||||
public int DiseasePoints { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public override void Load(Stream stream)
|
||||
{
|
||||
using (BinaryDataReader reader = new BinaryDataReader(stream, Encoding.ASCII, true))
|
||||
{
|
||||
WaterRise = reader.ReadInt32();
|
||||
DiseasePoints = reader.ReadInt32();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public override void Save(Stream stream)
|
||||
{
|
||||
using (BinaryDataWriter writer = new BinaryDataWriter(stream, Encoding.ASCII, true))
|
||||
{
|
||||
writer.Write(WaterRise);
|
||||
writer.Write(DiseasePoints);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,41 +1,9 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public class ParachuteStyle : StyleBase
|
||||
public class ParachuteStyle : IStyle
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
public int WindResponse { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public override void Load(Stream stream)
|
||||
{
|
||||
using (BinaryDataReader reader = new BinaryDataReader(stream, Encoding.ASCII, true))
|
||||
{
|
||||
WindResponse = reader.ReadInt32();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public override void Save(Stream stream)
|
||||
{
|
||||
using (BinaryDataWriter writer = new BinaryDataWriter(stream, Encoding.ASCII, true))
|
||||
{
|
||||
writer.Write(WindResponse);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public class PneumaticDrillStyle : StyleBase
|
||||
public class PneumaticDrillStyle : IStyle
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
@ -17,37 +11,5 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
public int ImpactAngle { get; set; }
|
||||
|
||||
public int TunellingTime { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public override void Load(Stream stream)
|
||||
{
|
||||
using (BinaryDataReader reader = new BinaryDataReader(stream, Encoding.ASCII, true))
|
||||
{
|
||||
Damage = reader.ReadInt32();
|
||||
PushPower = reader.ReadInt32();
|
||||
ImpactAngle = reader.ReadInt32();
|
||||
TunellingTime = reader.ReadInt32();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public override void Save(Stream stream)
|
||||
{
|
||||
using (BinaryDataWriter writer = new BinaryDataWriter(stream, Encoding.ASCII, true))
|
||||
{
|
||||
writer.Write(Damage);
|
||||
writer.Write(PushPower);
|
||||
writer.Write(ImpactAngle);
|
||||
writer.Write(TunellingTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public class ProdStyle : StyleBase
|
||||
public class ProdStyle : IStyle
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
@ -15,35 +9,5 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
public int Force { get; set; }
|
||||
|
||||
public int Angle { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public override void Load(Stream stream)
|
||||
{
|
||||
using (BinaryDataReader reader = new BinaryDataReader(stream, Encoding.ASCII, true))
|
||||
{
|
||||
Damage = reader.ReadInt32();
|
||||
Force = reader.ReadInt32();
|
||||
Angle = reader.ReadInt32();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public override void Save(Stream stream)
|
||||
{
|
||||
using (BinaryDataWriter writer = new BinaryDataWriter(stream, Encoding.ASCII, true))
|
||||
{
|
||||
writer.Write(Damage);
|
||||
writer.Write(Force);
|
||||
writer.Write(Angle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public abstract class StyleBase : ILoadable, ISaveable
|
||||
{
|
||||
public abstract void Load(Stream stream);
|
||||
|
||||
public abstract void Save(Stream stream);
|
||||
}
|
||||
}
|
@ -1,45 +1,11 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public class SuicideBomberStyle : StyleBase
|
||||
public class SuicideBomberStyle : IStyle
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
public int DiseasePoints { get; set; }
|
||||
|
||||
public int Damage { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public override void Load(Stream stream)
|
||||
{
|
||||
using (BinaryDataReader reader = new BinaryDataReader(stream, Encoding.ASCII, true))
|
||||
{
|
||||
DiseasePoints = reader.ReadInt32();
|
||||
Damage = reader.ReadInt32();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public override void Save(Stream stream)
|
||||
{
|
||||
using (BinaryDataWriter writer = new BinaryDataWriter(stream, Encoding.ASCII, true))
|
||||
{
|
||||
writer.Write(DiseasePoints);
|
||||
writer.Write(Damage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,8 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.Worms.Core;
|
||||
using Syroot.BinaryData;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public class ClusterTarget : TargetBase
|
||||
public class ClusterTarget : ITarget
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
@ -47,94 +44,12 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
|
||||
public Sound Sound { get; set; }
|
||||
|
||||
[BinaryMember(BooleanFormat = BinaryBooleanFormat.NonZeroDword)]
|
||||
public bool ExplodeOnSpace { get; set; }
|
||||
|
||||
public ExplosionAction ExplosionAction { get; set; }
|
||||
|
||||
public ActionBase Action { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public override void Load(Stream stream)
|
||||
{
|
||||
using (BinaryDataReader reader = new BinaryDataReader(stream, Encoding.ASCII, true))
|
||||
{
|
||||
ClusterCount = reader.ReadInt32();
|
||||
DispersionPower = reader.ReadInt32();
|
||||
Speed = reader.ReadInt32();
|
||||
EjectionAngle = reader.ReadInt32();
|
||||
DispersionAngle = reader.ReadInt32();
|
||||
Collisions = reader.ReadEnum<CollisionFlags>(false);
|
||||
ExplosionBias = reader.ReadInt32();
|
||||
ExplosionPushPower = reader.ReadInt32();
|
||||
ExplosionDamage = reader.ReadInt32();
|
||||
ExplosionDamageVariation = reader.ReadInt32();
|
||||
SpriteCount = reader.ReadInt32();
|
||||
Sprite = reader.ReadStruct<Sprite>();
|
||||
Acceleration = reader.ReadInt32();
|
||||
WindResponse = reader.ReadInt32();
|
||||
MotionRandomness = reader.ReadInt32();
|
||||
GravityFactor = reader.ReadInt32();
|
||||
Unused1 = reader.ReadInt32();
|
||||
Unused2 = reader.ReadInt32();
|
||||
Sound = reader.ReadStruct<Sound>();
|
||||
ExplodeOnSpace = reader.ReadBoolean(BinaryBooleanFormat.NonZeroDword);
|
||||
|
||||
ExplosionAction = reader.ReadEnum<ExplosionAction>(false);
|
||||
switch (ExplosionAction)
|
||||
{
|
||||
case ExplosionAction.Bounce:
|
||||
Action = reader.Load<BounceAction>();
|
||||
break;
|
||||
case ExplosionAction.Dig:
|
||||
Action = reader.Load<DigAction>();
|
||||
break;
|
||||
case ExplosionAction.Home:
|
||||
Action = reader.Load<HomeAction>();
|
||||
break;
|
||||
case ExplosionAction.Roam:
|
||||
Action = reader.Load<RoamAction>();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public override void Save(Stream stream)
|
||||
{
|
||||
using (BinaryDataWriter writer = new BinaryDataWriter(stream, Encoding.ASCII, true))
|
||||
{
|
||||
writer.Write(ClusterCount);
|
||||
writer.Write(DispersionPower);
|
||||
writer.Write(Speed);
|
||||
writer.Write(EjectionAngle);
|
||||
writer.Write(DispersionAngle);
|
||||
writer.Write(Collisions, true);
|
||||
writer.Write(ExplosionBias);
|
||||
writer.Write(ExplosionPushPower);
|
||||
writer.Write(ExplosionDamage);
|
||||
writer.Write(ExplosionDamageVariation);
|
||||
writer.Write(SpriteCount);
|
||||
writer.Write(Sprite);
|
||||
writer.Write(Acceleration);
|
||||
writer.Write(WindResponse);
|
||||
writer.Write(MotionRandomness);
|
||||
writer.Write(GravityFactor);
|
||||
writer.Write(Unused1);
|
||||
writer.Write(Unused2);
|
||||
writer.Write(Sound);
|
||||
writer.Write(ExplodeOnSpace, BinaryBooleanFormat.NonZeroDword);
|
||||
|
||||
writer.Write(ExplosionAction, true);
|
||||
writer.Save(Action);
|
||||
}
|
||||
}
|
||||
[BinaryMember(Converter = typeof(ActionConverter))]
|
||||
public IAction Action { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,8 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.BinaryData;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public class FireTarget : TargetBase
|
||||
public class FireTarget : ITarget
|
||||
{
|
||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||
|
||||
@ -14,38 +12,7 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
|
||||
public int Time { get; set; }
|
||||
|
||||
[BinaryMember(BooleanFormat = BinaryBooleanFormat.NonZeroDword)]
|
||||
public bool StayBetweenTurns { get; set; }
|
||||
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public override void Load(Stream stream)
|
||||
{
|
||||
using (BinaryDataReader reader = new BinaryDataReader(stream, Encoding.ASCII, true))
|
||||
{
|
||||
Power = reader.ReadInt32();
|
||||
Spread = reader.ReadInt32();
|
||||
Time = reader.ReadInt32();
|
||||
StayBetweenTurns = reader.ReadBoolean(BinaryBooleanFormat.NonZeroDword);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public override void Save(Stream stream)
|
||||
{
|
||||
using (BinaryDataWriter writer = new BinaryDataWriter(stream, Encoding.ASCII, true))
|
||||
{
|
||||
writer.Write(Power);
|
||||
writer.Write(Spread);
|
||||
writer.Write(Time);
|
||||
writer.Write(StayBetweenTurns, BinaryBooleanFormat.NonZeroDword);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,6 @@
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public interface ITarget
|
||||
{
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
using System.IO;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
public abstract class TargetBase : ILoadable, ISaveable
|
||||
{
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Loads the data from the given <see cref="Stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||
public abstract void Load(Stream stream);
|
||||
|
||||
/// <summary>
|
||||
/// Saves the data into the given <paramref name="stream"/>.
|
||||
/// </summary>
|
||||
/// <param name="stream">The <see cref="Stream"/> to save the data to.</param>
|
||||
public abstract void Save(Stream stream);
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using Syroot.BinaryData;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
internal class TargetConverter : IBinaryConverter
|
||||
{
|
||||
// ---- METHODS (PUBLIC) ---------------------------------------------------------------------------------------
|
||||
|
||||
public object Read(BinaryDataReader reader, object instance, BinaryMemberAttribute memberAttribute)
|
||||
{
|
||||
ExplosionTarget explosionTarget;
|
||||
switch (instance)
|
||||
{
|
||||
case LauncherStyle launcherStyle:
|
||||
explosionTarget = launcherStyle.ExplosionTarget;
|
||||
break;
|
||||
default:
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
switch (explosionTarget)
|
||||
{
|
||||
case ExplosionTarget.Clusters:
|
||||
return reader.ReadObject<ClusterTarget>();
|
||||
case ExplosionTarget.Fire:
|
||||
return reader.ReadObject<FireTarget>();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void Write(BinaryDataWriter writer, object instance, BinaryMemberAttribute memberAttribute, object value)
|
||||
{
|
||||
writer.WriteObject(value);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.BinaryData;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
@ -37,6 +37,8 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
|
||||
public WeaponActivation Activation { get; set; }
|
||||
|
||||
public int NotUsed { get; set; }
|
||||
|
||||
public int ThrowHerdCount { get; set; }
|
||||
|
||||
public int AirstrikeSubtype { get; set; }
|
||||
@ -47,7 +49,7 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
|
||||
public WeaponThrowAction ThrowAction { get; set; }
|
||||
|
||||
public StyleBase Style { get; set; }
|
||||
public IStyle Style { get; set; }
|
||||
|
||||
public bool AmmunitionOverride { get; set; }
|
||||
|
||||
@ -136,24 +138,24 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
case WeaponActivation.Airstrike:
|
||||
AirstrikeSubtype = reader.ReadInt32();
|
||||
Style = reader.Load<AirstrikeStyle>();
|
||||
Style = reader.ReadObject<AirstrikeStyle>();
|
||||
break;
|
||||
case WeaponActivation.Crosshair:
|
||||
reader.Seek(sizeof(int));
|
||||
NotUsed = reader.ReadInt32();
|
||||
CrosshairAction = reader.ReadEnum<WeaponCrosshairAction>(false);
|
||||
switch (CrosshairAction)
|
||||
{
|
||||
case WeaponCrosshairAction.Bow:
|
||||
Style = reader.Load<BowStyle>();
|
||||
Style = reader.ReadObject<BowStyle>();
|
||||
break;
|
||||
case WeaponCrosshairAction.Flamethrower:
|
||||
Style = reader.Load<FlamethrowerStyle>();
|
||||
Style = reader.ReadObject<FlamethrowerStyle>();
|
||||
break;
|
||||
case WeaponCrosshairAction.Gun:
|
||||
Style = reader.Load<GunStyle>();
|
||||
Style = reader.ReadObject<GunStyle>();
|
||||
break;
|
||||
case WeaponCrosshairAction.Launcher:
|
||||
Style = reader.Load<LauncherStyle>();
|
||||
Style = reader.ReadObject<LauncherStyle>();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -162,46 +164,46 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
switch (SpacebarAction)
|
||||
{
|
||||
case WeaponSpacebarAction.Armageddon:
|
||||
Style = reader.Load<LauncherStyle>();
|
||||
Style = reader.ReadObject<LauncherStyle>();
|
||||
break;
|
||||
case WeaponSpacebarAction.BaseballBat:
|
||||
Style = reader.Load<BaseballBatStyle>();
|
||||
Style = reader.ReadObject<BaseballBatStyle>();
|
||||
break;
|
||||
case WeaponSpacebarAction.BattleAxe:
|
||||
Style = reader.Load<BattleAxeStyle>();
|
||||
Style = reader.ReadObject<BattleAxeStyle>();
|
||||
break;
|
||||
case WeaponSpacebarAction.Blowtorch:
|
||||
Style = reader.Load<BlowtorchStyle>();
|
||||
Style = reader.ReadObject<BlowtorchStyle>();
|
||||
break;
|
||||
case WeaponSpacebarAction.Dragonball:
|
||||
Style = reader.Load<DragonballStyle>();
|
||||
Style = reader.ReadObject<DragonballStyle>();
|
||||
break;
|
||||
case WeaponSpacebarAction.Firepunch:
|
||||
Style = reader.Load<FirepunchStyle>();
|
||||
Style = reader.ReadObject<FirepunchStyle>();
|
||||
break;
|
||||
case WeaponSpacebarAction.Jetpack:
|
||||
Style = reader.Load<JetpackStyle>();
|
||||
Style = reader.ReadObject<JetpackStyle>();
|
||||
break;
|
||||
case WeaponSpacebarAction.Kamikaze:
|
||||
Style = reader.Load<KamikazeStyle>();
|
||||
Style = reader.ReadObject<KamikazeStyle>();
|
||||
break;
|
||||
case WeaponSpacebarAction.NinjaRope:
|
||||
Style = reader.Load<NinjaRopeStyle>();
|
||||
Style = reader.ReadObject<NinjaRopeStyle>();
|
||||
break;
|
||||
case WeaponSpacebarAction.NuclearTest:
|
||||
Style = reader.Load<NuclearTestStyle>();
|
||||
Style = reader.ReadObject<NuclearTestStyle>();
|
||||
break;
|
||||
case WeaponSpacebarAction.Parachute:
|
||||
Style = reader.Load<ParachuteStyle>();
|
||||
Style = reader.ReadObject<ParachuteStyle>();
|
||||
break;
|
||||
case WeaponSpacebarAction.PneumaticDrill:
|
||||
Style = reader.Load<PneumaticDrillStyle>();
|
||||
Style = reader.ReadObject<PneumaticDrillStyle>();
|
||||
break;
|
||||
case WeaponSpacebarAction.Prod:
|
||||
Style = reader.Load<ProdStyle>();
|
||||
Style = reader.ReadObject<ProdStyle>();
|
||||
break;
|
||||
case WeaponSpacebarAction.SuicideBomber:
|
||||
Style = reader.Load<SuicideBomberStyle>();
|
||||
Style = reader.ReadObject<SuicideBomberStyle>();
|
||||
break;
|
||||
case WeaponSpacebarAction.Bungee:
|
||||
case WeaponSpacebarAction.Earthquake:
|
||||
@ -223,13 +225,13 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
switch (ThrowAction)
|
||||
{
|
||||
case WeaponThrowAction.Canister:
|
||||
Style = reader.Load<CanisterStyle>();
|
||||
Style = reader.ReadObject<CanisterStyle>();
|
||||
break;
|
||||
case WeaponThrowAction.Launcher:
|
||||
Style = reader.Load<LauncherStyle>();
|
||||
Style = reader.ReadObject<LauncherStyle>();
|
||||
break;
|
||||
case WeaponThrowAction.Mine:
|
||||
Style = reader.Load<MineStyle>();
|
||||
Style = reader.ReadObject<MineStyle>();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -306,14 +308,14 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
{
|
||||
case WeaponActivation.Airstrike:
|
||||
writer.Write(AirstrikeSubtype);
|
||||
writer.Save(Style);
|
||||
writer.WriteObject(Style);
|
||||
break;
|
||||
case WeaponActivation.Crosshair:
|
||||
writer.Seek(sizeof(int));
|
||||
writer.Write(NotUsed);
|
||||
writer.Write(CrosshairAction, true);
|
||||
if (CrosshairAction != WeaponCrosshairAction.None)
|
||||
{
|
||||
writer.Save(Style);
|
||||
writer.WriteObject(Style);
|
||||
}
|
||||
break;
|
||||
case WeaponActivation.Spacebar:
|
||||
@ -334,7 +336,7 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
case WeaponSpacebarAction.PneumaticDrill:
|
||||
case WeaponSpacebarAction.Prod:
|
||||
case WeaponSpacebarAction.SuicideBomber:
|
||||
writer.Save(Style);
|
||||
writer.WriteObject(Style);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -343,7 +345,7 @@ namespace Syroot.Worms.Gen2.Armageddon.ProjectX
|
||||
writer.Write(ThrowAction, true);
|
||||
if (ThrowAction != WeaponThrowAction.None)
|
||||
{
|
||||
writer.Save(Style);
|
||||
writer.WriteObject(Style);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.BinaryData;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.BinaryData;
|
||||
using Syroot.Maths;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
|
@ -2,7 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.BinaryData;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Armageddon
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.BinaryData;
|
||||
using Syroot.Maths;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
using System.IO;
|
||||
using Syroot.IO;
|
||||
using Syroot.BinaryData;
|
||||
using Syroot.Maths;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.BinaryData;
|
||||
using Syroot.Maths;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.BinaryData;
|
||||
using Syroot.Maths;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
|
@ -2,7 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.BinaryData;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.WorldParty
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.BinaryData;
|
||||
using Syroot.Maths;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.BinaryData;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Worms2
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.BinaryData;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Worms2
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.BinaryData;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Worms2
|
||||
|
@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Syroot.IO;
|
||||
using Syroot.BinaryData;
|
||||
using Syroot.Worms.Core;
|
||||
|
||||
namespace Syroot.Worms.Gen2.Worms2
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ImageSharp" Version="1.0.0-alpha7-00006" />
|
||||
<PackageReference Include="Syroot.IO.BinaryData" Version="1.3.0" />
|
||||
<PackageReference Include="Syroot.IO.BinaryData" Version="2.0.0-rc1" />
|
||||
<PackageReference Include="Syroot.Maths" Version="1.3.1" />
|
||||
</ItemGroup>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user