mirror of
https://gitlab.com/Syroot/Worms.git
synced 2025-01-27 22:27:58 +03:00
Implement W:A V3 schemes.
This commit is contained in:
parent
1d06fbd578
commit
861d5ea585
43
src/library/Syroot.Worms.Armageddon/Scheme.WeaponList.cs
Normal file
43
src/library/Syroot.Worms.Armageddon/Scheme.WeaponList.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Syroot.Worms.Armageddon
|
||||
{
|
||||
partial class Scheme
|
||||
{
|
||||
// ---- CLASSES, STRUCTS & ENUMS -------------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Represents a list of <see cref="SchemeWeapon"/> instances which can be accessed by <see cref="Weapon"/>.
|
||||
/// </summary>
|
||||
public class WeaponList : IReadOnlyCollection<SchemeWeapon>
|
||||
{
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
|
||||
private readonly SchemeWeapon[] _list = new SchemeWeapon[64];
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the weapon with the given <paramref name="index"/>.
|
||||
/// </summary>
|
||||
/// <param name="name">The index of the weapon to access.</param>
|
||||
/// <returns>A reference to the <see cref="SchemeWeapon"/>.</returns>
|
||||
public ref SchemeWeapon this[int index] => ref _list[index];
|
||||
|
||||
/// <summary>
|
||||
/// Gets a reference to the weapon with the given <paramref name="name"/>.
|
||||
/// </summary>
|
||||
/// <param name="name">The <see cref="Weapon"/> of the weapon to access.</param>
|
||||
/// <returns>A reference to the <see cref="SchemeWeapon"/>.</returns>
|
||||
public ref SchemeWeapon this[Weapon name] => ref _list[(int)name];
|
||||
|
||||
/// <inheritdoc/>
|
||||
public int Count => _list.Length;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public IEnumerator<SchemeWeapon> GetEnumerator() => ((IEnumerable<SchemeWeapon>)_list).GetEnumerator();
|
||||
|
||||
/// <inheritdoc/>
|
||||
IEnumerator IEnumerable.GetEnumerator() => _list.GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -14,7 +14,23 @@ namespace Syroot.Worms.Armageddon
|
||||
/// <summary>Cures all allied teams of the worm collecting the health crate.</summary>
|
||||
Allies,
|
||||
/// <summary>Cures nobody.</summary>
|
||||
Nobody = 255
|
||||
Nobody = Byte.MaxValue
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the types of objects which can appear on the map.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum MapObjectType
|
||||
{
|
||||
/// <summary>Neither mines or oil drums are placed on the map.</summary>
|
||||
None,
|
||||
/// <summary>Only mines are placed on the map.</summary>
|
||||
Mines = 1 << 0,
|
||||
/// <summary>Only oil drums are placed on the map.</summary>
|
||||
OilDrums = 1 << 1,
|
||||
/// <summary>Both mines and oil drums are placed on the map.</summary>
|
||||
Both = Mines | OilDrums
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -106,11 +122,11 @@ namespace Syroot.Worms.Armageddon
|
||||
public enum SkimControlLoss : byte
|
||||
{
|
||||
/// <summary>Control is lost when skimming.</summary>
|
||||
Lose,
|
||||
Lost,
|
||||
/// <summary>Control is retained but the rope cannot be shot again until landing.</summary>
|
||||
Keep,
|
||||
Kept,
|
||||
/// <summary>Control is retained and the rope can be shot even before landing.</summary>
|
||||
KeepWithRope
|
||||
KeptWithRope
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -123,7 +139,7 @@ namespace Syroot.Worms.Armageddon
|
||||
/// <summary>Skip walking is possible by using the up and down arrow keys.</summary>
|
||||
Facilitated,
|
||||
/// <summary>Skip walking is prevented.</summary>
|
||||
Disabled = 255
|
||||
Disabled = Byte.MaxValue
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -167,22 +183,6 @@ namespace Syroot.Worms.Armageddon
|
||||
WaterRise
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the types of objects which can appear on the map.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum MapObjectType
|
||||
{
|
||||
/// <summary>Neither mines or oil drums are placed on the map.</summary>
|
||||
None,
|
||||
/// <summary>Only mines are placed on the map.</summary>
|
||||
Mines = 1 << 0,
|
||||
/// <summary>Only oil drums are placed on the map.</summary>
|
||||
OilDrums = 1 << 1,
|
||||
/// <summary>Both mines and oil drums are placed on the map.</summary>
|
||||
Both = Mines | OilDrums
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the objects or effects worms phase through.
|
||||
/// </summary>
|
||||
@ -197,4 +197,15 @@ namespace Syroot.Worms.Armageddon
|
||||
/// <summary>Worms are not affected by other worms, weapons, and damage.</summary>
|
||||
WormsWeaponsDamage
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the possible loss of control on high speed horizontal collisions.
|
||||
/// </summary>
|
||||
public enum XImpactControlLoss : byte
|
||||
{
|
||||
/// <summary>Control is lost.</summary>
|
||||
Loss,
|
||||
/// <summary>Control is retained.</summary>
|
||||
Kept = Byte.MaxValue
|
||||
}
|
||||
}
|
||||
|
1141
src/library/Syroot.Worms.Armageddon/SchemeExtendedOptions.cs
Normal file
1141
src/library/Syroot.Worms.Armageddon/SchemeExtendedOptions.cs
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(SolutionDir)build.xml" />
|
||||
<PropertyGroup>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<AssemblyName>Syroot.Worms.Armageddon</AssemblyName>
|
||||
<Description>.NET library for loading and modifying files of Team17's Worms Armageddon.</Description>
|
||||
<PackageReleaseNotes>Fix issues when loading and saving some formats. Simplify Scheme usage.</PackageReleaseNotes>
|
||||
|
@ -240,10 +240,9 @@ namespace Syroot.Worms.Core.IO
|
||||
/// <typeparam name="T">The type of the structure to read.</typeparam>
|
||||
/// <param name="self">The extended <see cref="BinaryStream"/> instance.</param>
|
||||
/// <param name="value">The structure to write.</param>
|
||||
public static void WriteStruct<T>(this BinaryStream self, T value) where T : unmanaged
|
||||
public static unsafe void WriteStruct<T>(this BinaryStream self, T value) where T : unmanaged
|
||||
{
|
||||
ReadOnlySpan<byte> bytes;
|
||||
unsafe { bytes = new ReadOnlySpan<byte>(Unsafe.AsPointer(ref value), Unsafe.SizeOf<T>()); }
|
||||
ReadOnlySpan<byte> bytes = new ReadOnlySpan<byte>(Unsafe.AsPointer(ref value), Unsafe.SizeOf<T>());
|
||||
#if NETSTANDARD2_0
|
||||
self.Write(bytes.ToArray()); // cannot prevent copy in .NET Standard 2.0
|
||||
#else
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user