mirror of
https://gitlab.com/Syroot/Worms.git
synced 2025-05-05 11:19:29 +03:00
Arnageddon
- Make Scheme.Extended a field rather than an uncommon ref property. Set ObjectCount to 8 by default. - Make ExtendedOptions.Default public. - Simplify comparison of ExtendedOptions instances.
This commit is contained in:
parent
4454cb1496
commit
dd2e67eab9
@ -47,7 +47,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = " Solution Items", " Solut
|
|||||||
test.xml = test.xml
|
test.xml = test.xml
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Syroot.Worms.SchemeEditor", "tool\Syroot.Worms.SchemeEditor\Syroot.Worms.SchemeEditor.csproj", "{06FC5993-E3F0-4826-AE88-5639446A14B6}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Syroot.Worms.SchemeEditor", "tool\Syroot.Worms.SchemeEditor\Syroot.Worms.SchemeEditor.csproj", "{06FC5993-E3F0-4826-AE88-5639446A14B6}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
@ -15,7 +15,8 @@ namespace Syroot.Worms.Armageddon
|
|||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
public struct ExtendedOptions : IEquatable<ExtendedOptions>
|
public struct ExtendedOptions : IEquatable<ExtendedOptions>
|
||||||
{
|
{
|
||||||
internal static readonly ExtendedOptions Default = new ExtendedOptions
|
/// <summary>Unchanged settings as available in a new scheme.</summary>
|
||||||
|
public static readonly ExtendedOptions Default = new ExtendedOptions
|
||||||
{
|
{
|
||||||
Wind = 100,
|
Wind = 100,
|
||||||
WindBias = 15,
|
WindBias = 15,
|
||||||
@ -948,80 +949,7 @@ namespace Syroot.Worms.Armageddon
|
|||||||
public override bool Equals(object obj) => obj is ExtendedOptions options && Equals(options);
|
public override bool Equals(object obj) => obj is ExtendedOptions options && Equals(options);
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public bool Equals(ExtendedOptions other)
|
public bool Equals(ExtendedOptions other) => AsSpan().SequenceEqual(other.AsSpan());
|
||||||
=> _dataVersion == other._dataVersion
|
|
||||||
&& _constantWind == other._constantWind
|
|
||||||
&& _wind == other._wind
|
|
||||||
&& _windBias == other._windBias
|
|
||||||
&& _gravity == other._gravity
|
|
||||||
&& _friction == other._friction
|
|
||||||
&& _ropeKnockForce == other._ropeKnockForce
|
|
||||||
&& _bloodAmount == other._bloodAmount
|
|
||||||
&& _ropeUpgrade == other._ropeUpgrade
|
|
||||||
&& _groupPlaceAllies == other._groupPlaceAllies
|
|
||||||
&& _noCrateProbability == other._noCrateProbability
|
|
||||||
&& _crateLimit == other._crateLimit
|
|
||||||
&& _suddenDeathNoWormSelect == other._suddenDeathNoWormSelect
|
|
||||||
&& _suddenDeathTurnDamage == other._suddenDeathTurnDamage
|
|
||||||
&& _wormPhasingAlly == other._wormPhasingAlly
|
|
||||||
&& _wormPhasingEnemy == other._wormPhasingEnemy
|
|
||||||
&& _circularAim == other._circularAim
|
|
||||||
&& _antiLockAim == other._antiLockAim
|
|
||||||
&& _antiLockPower == other._antiLockPower
|
|
||||||
&& _wormSelectKeepHotSeat == other._wormSelectKeepHotSeat
|
|
||||||
&& _wormSelectAnytime == other._wormSelectAnytime
|
|
||||||
&& _battyRope == other._battyRope
|
|
||||||
&& _ropeRollDrops == other._ropeRollDrops
|
|
||||||
&& _keepControlXImpact == other._keepControlXImpact
|
|
||||||
&& _keepControlHeadBump == other._keepControlHeadBump
|
|
||||||
&& _keepControlSkim == other._keepControlSkim
|
|
||||||
&& _explosionFallDamage == other._explosionFallDamage
|
|
||||||
&& _objectPushByExplosion == other._objectPushByExplosion
|
|
||||||
&& _undeterminedCrates == other._undeterminedCrates
|
|
||||||
&& _undeterminedMineFuse == other._undeterminedMineFuse
|
|
||||||
&& _firingPausesTimer == other._firingPausesTimer
|
|
||||||
&& _loseControlDoesntEndTurn == other._loseControlDoesntEndTurn
|
|
||||||
&& _shotDoesntEndTurn == other._shotDoesntEndTurn
|
|
||||||
&& _shotDoesntEndTurnAll == other._shotDoesntEndTurnAll
|
|
||||||
&& _drillImpartsVelocity == other._drillImpartsVelocity
|
|
||||||
&& _girderRadiusAssist == other._girderRadiusAssist
|
|
||||||
&& _flameTurnDecay == other._flameTurnDecay
|
|
||||||
&& _flameTouchDecay == other._flameTouchDecay
|
|
||||||
&& _flameLimit == other._flameLimit
|
|
||||||
&& _projectileMaxSpeed == other._projectileMaxSpeed
|
|
||||||
&& _ropeMaxSpeed == other._ropeMaxSpeed
|
|
||||||
&& _jetpackMaxSpeed == other._jetpackMaxSpeed
|
|
||||||
&& _gameSpeed == other._gameSpeed
|
|
||||||
&& _indianRopeGlitch == other._indianRopeGlitch
|
|
||||||
&& _herdDoublingGlitch == other._herdDoublingGlitch
|
|
||||||
&& _jetpackBungeeGlitch == other._jetpackBungeeGlitch
|
|
||||||
&& _angleCheatGlitch == other._angleCheatGlitch
|
|
||||||
&& _glideGlitch == other._glideGlitch
|
|
||||||
&& _skipWalk == other._skipWalk
|
|
||||||
&& _roofing == other._roofing
|
|
||||||
&& _floatingWeaponGlitch == other._floatingWeaponGlitch
|
|
||||||
&& _wormBounce == other._wormBounce
|
|
||||||
&& _viscosity == other._viscosity
|
|
||||||
&& _viscosityWorms == other._viscosityWorms
|
|
||||||
&& _rwWind == other._rwWind
|
|
||||||
&& _rwWindWorms == other._rwWindWorms
|
|
||||||
&& _rwGravityType == other._rwGravityType
|
|
||||||
&& _rwGravity == other._rwGravity
|
|
||||||
&& _crateRate == other._crateRate
|
|
||||||
&& _crateShower == other._crateShower
|
|
||||||
&& _antiSink == other._antiSink
|
|
||||||
&& _weaponsDontChange == other._weaponsDontChange
|
|
||||||
&& _extendedFuse == other._extendedFuse
|
|
||||||
&& _autoReaim == other._autoReaim
|
|
||||||
&& _terrainOverlapGlitch == other._terrainOverlapGlitch
|
|
||||||
&& _roundTimeFractional == other._roundTimeFractional
|
|
||||||
&& _autoRetreat == other._autoRetreat
|
|
||||||
&& _healthCure == other._healthCure
|
|
||||||
&& _kaosMod == other._kaosMod
|
|
||||||
&& _sheepHeavenFlags == other._sheepHeavenFlags
|
|
||||||
&& _conserveUtilities == other._conserveUtilities
|
|
||||||
&& _expediteUtilities == other._expediteUtilities
|
|
||||||
&& _doubleTimeCount == other._doubleTimeCount;
|
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override int GetHashCode()
|
public override int GetHashCode()
|
||||||
|
@ -27,17 +27,21 @@ namespace Syroot.Worms.Armageddon
|
|||||||
|
|
||||||
// ---- FIELDS -------------------------------------------------------------------------------------------------
|
// ---- FIELDS -------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="SchemeVersion.Version3"/> or RubberWorm settings.
|
||||||
|
/// </summary>
|
||||||
|
public ExtendedOptions Extended = ExtendedOptions.Default;
|
||||||
|
|
||||||
private static readonly byte[] _waterRiseRates;
|
private static readonly byte[] _waterRiseRates;
|
||||||
|
|
||||||
private int _fallDamage;
|
private int _fallDamage;
|
||||||
private byte _waterRiseIndex;
|
private byte _waterRiseIndex;
|
||||||
private byte _objectCount;
|
private byte _objectCount = 8;
|
||||||
private byte _mineDelay;
|
private byte _mineDelay;
|
||||||
private byte _turnTime;
|
private byte _turnTime;
|
||||||
private byte _roundTimeMinutes;
|
private byte _roundTimeMinutes;
|
||||||
private byte _roundTimeSeconds;
|
private byte _roundTimeSeconds;
|
||||||
|
|
||||||
private ExtendedOptions _extended = ExtendedOptions.Default;
|
|
||||||
private ushort _rwVersion;
|
private ushort _rwVersion;
|
||||||
|
|
||||||
// ---- CONSTRUCTORS & DESTRUCTOR ------------------------------------------------------------------------------
|
// ---- CONSTRUCTORS & DESTRUCTOR ------------------------------------------------------------------------------
|
||||||
@ -435,11 +439,6 @@ namespace Syroot.Worms.Armageddon
|
|||||||
|
|
||||||
// ---- Extended Options ----
|
// ---- Extended Options ----
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets <see cref="SchemeVersion.Version3"/> or RubberWorm settings.
|
|
||||||
/// </summary>
|
|
||||||
public ref ExtendedOptions Extended => ref _extended;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets trailing bytes which could not be parsed and will be attached when saving the scheme anew.
|
/// Gets or sets trailing bytes which could not be parsed and will be attached when saving the scheme anew.
|
||||||
/// These may be unknown <see cref="SchemeVersion.Version3"/> extended scheme options or WWP trash.
|
/// These may be unknown <see cref="SchemeVersion.Version3"/> extended scheme options or WWP trash.
|
||||||
@ -451,7 +450,7 @@ namespace Syroot.Worms.Armageddon
|
|||||||
/// the effects of the forced version.
|
/// the effects of the forced version.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>Configurable with the /version command in RubberWorm.
|
/// <remarks>Configurable with the /version command in RubberWorm.
|
||||||
/// S. http://worms2d.info/List_of_Worms_Armageddon_logic_versions.</remarks>
|
/// S. http://worms2d.info/List_of_Worms_Armageddon_logic_versions .</remarks>
|
||||||
public ushort RwVersion
|
public ushort RwVersion
|
||||||
{
|
{
|
||||||
get => _rwVersion;
|
get => _rwVersion;
|
||||||
@ -1227,7 +1226,7 @@ namespace Syroot.Worms.Armageddon
|
|||||||
private unsafe void LoadExtendedOptions(BinaryStream reader)
|
private unsafe void LoadExtendedOptions(BinaryStream reader)
|
||||||
{
|
{
|
||||||
// Create a copy of default options overwritten by available extended data.
|
// Create a copy of default options overwritten by available extended data.
|
||||||
Span<byte> bytes = _extended.AsSpan();
|
Span<byte> bytes = Extended.AsSpan();
|
||||||
ExtendedOptions.Default.AsSpan().CopyTo(bytes);
|
ExtendedOptions.Default.AsSpan().CopyTo(bytes);
|
||||||
reader.Read(bytes);
|
reader.Read(bytes);
|
||||||
}
|
}
|
||||||
@ -1348,7 +1347,7 @@ namespace Syroot.Worms.Armageddon
|
|||||||
|
|
||||||
private unsafe void SaveExtendedOptions(BinaryStream writer, bool trim)
|
private unsafe void SaveExtendedOptions(BinaryStream writer, bool trim)
|
||||||
{
|
{
|
||||||
ReadOnlySpan<byte> bytes = _extended.AsSpan();
|
ReadOnlySpan<byte> bytes = Extended.AsSpan();
|
||||||
|
|
||||||
// Trim away default bytes.
|
// Trim away default bytes.
|
||||||
int length = bytes.Length;
|
int length = bytes.Length;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<Description>.NET library for loading and modifying files of Team17's Worms Armageddon.</Description>
|
<Description>.NET library for loading and modifying files of Team17's Worms Armageddon.</Description>
|
||||||
<PackageReleaseNotes>Overhaul implementation and documentation. Implement W:A V3 scheme format.</PackageReleaseNotes>
|
<PackageReleaseNotes>Overhaul implementation and documentation. Implement W:A V3 scheme format.</PackageReleaseNotes>
|
||||||
<PackageTags>$(PackageTags);worms armageddon</PackageTags>
|
<PackageTags>$(PackageTags);worms armageddon</PackageTags>
|
||||||
<Version>4.0.1</Version>
|
<Version>4.0.2</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<!-- References -->
|
<!-- References -->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user