mirror of
https://gitlab.com/Syroot/Worms.git
synced 2025-01-15 00:08:02 +03:00
Update repository
This commit is contained in:
parent
d57de03cf7
commit
f60a17bfca
@ -5,7 +5,7 @@ using Syroot.Worms.UnitTest.Common;
|
|||||||
namespace Syroot.Worms.UnitTest.Gen2
|
namespace Syroot.Worms.UnitTest.Gen2
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a collection of tests for the <see cref="Image"/> class.
|
/// Represents a collection of tests for the <see cref="ImageData"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[TestCategory("Gen2")]
|
[TestCategory("Gen2")]
|
||||||
[TestClass]
|
[TestClass]
|
||||||
@ -19,7 +19,7 @@ namespace Syroot.Worms.UnitTest.Gen2
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void LoadImages()
|
public void LoadImages()
|
||||||
{
|
{
|
||||||
TestHelpers.LoadFiles<Image>(Game.All, "*.img");
|
TestHelpers.LoadFiles<ImageData>(Game.All, "*.img");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ namespace Syroot.Worms
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a pixel-based 2D image in different color formats.
|
/// Represents a pixel-based 2D image in different color formats.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ImageData
|
public class BitmapData
|
||||||
{
|
{
|
||||||
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
// ---- PROPERTIES ---------------------------------------------------------------------------------------------
|
||||||
|
|
@ -74,17 +74,17 @@ namespace Syroot.Worms.Gen2.Armageddon
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the visual foreground image.
|
/// Gets or sets the visual foreground image.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Image Foreground { get; set; }
|
public ImageData Foreground { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the collision mask of the landscape.
|
/// Gets or sets the collision mask of the landscape.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Image CollisionMask { get; set; }
|
public ImageData CollisionMask { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the visual background image.
|
/// Gets or sets the visual background image.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Image Background { get; set; }
|
public ImageData Background { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the path to the land image file.
|
/// Gets or sets the path to the land image file.
|
||||||
@ -123,9 +123,9 @@ namespace Syroot.Worms.Gen2.Armageddon
|
|||||||
ObjectLocations = reader.ReadStructs<Vector2>(reader.ReadInt32());
|
ObjectLocations = reader.ReadStructs<Vector2>(reader.ReadInt32());
|
||||||
|
|
||||||
// Read the image data.
|
// Read the image data.
|
||||||
Foreground = reader.Load<Image>();
|
Foreground = reader.Load<ImageData>();
|
||||||
CollisionMask = reader.Load<Image>();
|
CollisionMask = reader.Load<ImageData>();
|
||||||
Background = reader.Load<Image>();
|
Background = reader.Load<ImageData>();
|
||||||
|
|
||||||
// Read the file paths.
|
// Read the file paths.
|
||||||
LandTexturePath = reader.ReadString(BinaryStringFormat.ByteLengthPrefix);
|
LandTexturePath = reader.ReadString(BinaryStringFormat.ByteLengthPrefix);
|
||||||
|
@ -81,7 +81,7 @@ namespace Syroot.Worms.Gen2.Armageddon
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the team grave bitmap if it uses a custom one.
|
/// Gets or sets the team grave bitmap if it uses a custom one.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ImageData Grave { get; set; }
|
public BitmapData Grave { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the team's special weapon.
|
/// Gets or sets the team's special weapon.
|
||||||
@ -151,7 +151,7 @@ namespace Syroot.Worms.Gen2.Armageddon
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the bitmap of the team flag.
|
/// Gets or sets the bitmap of the team flag.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ImageData Flag { get; set; }
|
public BitmapData Flag { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the deathmatch rank this team reached.
|
/// Gets or sets the deathmatch rank this team reached.
|
||||||
@ -210,7 +210,7 @@ namespace Syroot.Worms.Gen2.Armageddon
|
|||||||
if (GraveSprite < 0)
|
if (GraveSprite < 0)
|
||||||
{
|
{
|
||||||
GraveFileName = reader.ReadFixedString(0x20);
|
GraveFileName = reader.ReadFixedString(0x20);
|
||||||
Grave = new ImageData()
|
Grave = new BitmapData()
|
||||||
{
|
{
|
||||||
BitsPerPixel = 8,
|
BitsPerPixel = 8,
|
||||||
Size = new Vector2(24, 32),
|
Size = new Vector2(24, 32),
|
||||||
@ -233,7 +233,7 @@ namespace Syroot.Worms.Gen2.Armageddon
|
|||||||
MissionStatuses = reader.ReadStructs<TeamMissionStatus>(_missionCount);
|
MissionStatuses = reader.ReadStructs<TeamMissionStatus>(_missionCount);
|
||||||
|
|
||||||
FlagFileName = reader.ReadFixedString(0x20);
|
FlagFileName = reader.ReadFixedString(0x20);
|
||||||
Flag = new ImageData()
|
Flag = new BitmapData()
|
||||||
{
|
{
|
||||||
BitsPerPixel = 8,
|
BitsPerPixel = 8,
|
||||||
Size = new Vector2(20, 17),
|
Size = new Vector2(20, 17),
|
||||||
|
@ -11,7 +11,7 @@ namespace Syroot.Worms.Gen2
|
|||||||
/// Represents a (palettized) graphical image stored in an IMG file, possibly compressed.
|
/// Represents a (palettized) graphical image stored in an IMG file, possibly compressed.
|
||||||
/// Used by W2, WA and WWP. S. https://worms2d.info/Image_file.
|
/// Used by W2, WA and WWP. S. https://worms2d.info/Image_file.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Image : ImageData, ILoadableFile, ISaveableFile
|
public class ImageData : BitmapData, ILoadableFile, ISaveableFile
|
||||||
{
|
{
|
||||||
// ---- CONSTANTS ----------------------------------------------------------------------------------------------
|
// ---- CONSTANTS ----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -20,38 +20,38 @@ namespace Syroot.Worms.Gen2
|
|||||||
// ---- CONSTRUCTORS & DESTRUCTOR ------------------------------------------------------------------------------
|
// ---- CONSTRUCTORS & DESTRUCTOR ------------------------------------------------------------------------------
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Image"/> class.
|
/// Initializes a new instance of the <see cref="ImageData"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Image()
|
public ImageData()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Image"/> class, loading the data from the given
|
/// Initializes a new instance of the <see cref="ImageData"/> class, loading the data from the given
|
||||||
/// <see cref="Stream"/>.
|
/// <see cref="Stream"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||||
public Image(Stream stream)
|
public ImageData(Stream stream)
|
||||||
{
|
{
|
||||||
Load(stream);
|
Load(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Image"/> class, loading the data from the given file.
|
/// Initializes a new instance of the <see cref="ImageData"/> class, loading the data from the given file.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="fileName">The name of the file to load the data from.</param>
|
/// <param name="fileName">The name of the file to load the data from.</param>
|
||||||
public Image(string fileName)
|
public ImageData(string fileName)
|
||||||
{
|
{
|
||||||
Load(fileName);
|
Load(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Image"/> class, loading the data from the given
|
/// Initializes a new instance of the <see cref="ImageData"/> class, loading the data from the given
|
||||||
/// <see cref="Stream"/>. The data block can be aligned to a 4-bte boundary.
|
/// <see cref="Stream"/>. The data block can be aligned to a 4-bte boundary.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
/// <param name="stream">The <see cref="Stream"/> to load the data from.</param>
|
||||||
/// <param name="alignData"><c>true</c> to align the data array by 4 bytes.</param>
|
/// <param name="alignData"><c>true</c> to align the data array by 4 bytes.</param>
|
||||||
internal Image(Stream stream, bool alignData)
|
internal ImageData(Stream stream, bool alignData)
|
||||||
{
|
{
|
||||||
Load(stream, alignData);
|
Load(stream, alignData);
|
||||||
}
|
}
|
@ -70,17 +70,17 @@ namespace Syroot.Worms.Gen2.WorldParty
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the visual foreground image.
|
/// Gets or sets the visual foreground image.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Image Foreground { get; set; }
|
public ImageData Foreground { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the collision mask of the landscape.
|
/// Gets or sets the collision mask of the landscape.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Image CollisionMask { get; set; }
|
public ImageData CollisionMask { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the visual background image.
|
/// Gets or sets the visual background image.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Image Background { get; set; }
|
public ImageData Background { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the path to the land image file.
|
/// Gets or sets the path to the land image file.
|
||||||
@ -118,9 +118,9 @@ namespace Syroot.Worms.Gen2.WorldParty
|
|||||||
ObjectLocations = reader.ReadStructs<Vector2>(reader.ReadInt32());
|
ObjectLocations = reader.ReadStructs<Vector2>(reader.ReadInt32());
|
||||||
|
|
||||||
// Read the image data.
|
// Read the image data.
|
||||||
Foreground = new Image(stream, true);
|
Foreground = new ImageData(stream, true);
|
||||||
CollisionMask = new Image(stream, true);
|
CollisionMask = new ImageData(stream, true);
|
||||||
Background = new Image(stream, true);
|
Background = new ImageData(stream, true);
|
||||||
|
|
||||||
// Read the file paths.
|
// Read the file paths.
|
||||||
LandTexturePath = reader.ReadString(BinaryStringFormat.ByteLengthPrefix);
|
LandTexturePath = reader.ReadString(BinaryStringFormat.ByteLengthPrefix);
|
||||||
|
@ -79,7 +79,7 @@ namespace Syroot.Worms.Gen2.WorldParty
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the team grave bitmap if it uses a custom one.
|
/// Gets or sets the team grave bitmap if it uses a custom one.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ImageData Grave { get; set; }
|
public BitmapData Grave { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the team's special weapon.
|
/// Gets or sets the team's special weapon.
|
||||||
@ -149,7 +149,7 @@ namespace Syroot.Worms.Gen2.WorldParty
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the bitmap of the team flag.
|
/// Gets or sets the bitmap of the team flag.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ImageData Flag { get; set; }
|
public BitmapData Flag { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets an unknown value.
|
/// Gets or sets an unknown value.
|
||||||
@ -209,7 +209,7 @@ namespace Syroot.Worms.Gen2.WorldParty
|
|||||||
if (GraveSprite < 0)
|
if (GraveSprite < 0)
|
||||||
{
|
{
|
||||||
GraveFileName = reader.ReadFixedString(0x20);
|
GraveFileName = reader.ReadFixedString(0x20);
|
||||||
Grave = new ImageData()
|
Grave = new BitmapData()
|
||||||
{
|
{
|
||||||
BitsPerPixel = 8,
|
BitsPerPixel = 8,
|
||||||
Size = new Vector2(24, 32),
|
Size = new Vector2(24, 32),
|
||||||
@ -232,7 +232,7 @@ namespace Syroot.Worms.Gen2.WorldParty
|
|||||||
MissionStatuses = reader.ReadStructs<TeamMissionStatus>(_missionCount);
|
MissionStatuses = reader.ReadStructs<TeamMissionStatus>(_missionCount);
|
||||||
|
|
||||||
FlagFileName = reader.ReadFixedString(0x20);
|
FlagFileName = reader.ReadFixedString(0x20);
|
||||||
Flag = new ImageData()
|
Flag = new BitmapData()
|
||||||
{
|
{
|
||||||
BitsPerPixel = 8,
|
BitsPerPixel = 8,
|
||||||
Size = new Vector2(20, 17),
|
Size = new Vector2(20, 17),
|
||||||
|
@ -69,22 +69,22 @@ namespace Syroot.Worms.Gen2.Worms2
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the visual foreground image.
|
/// Gets or sets the visual foreground image.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Image Foreground { get; set; }
|
public ImageData Foreground { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the collision mask of the landscape.
|
/// Gets or sets the collision mask of the landscape.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Image CollisionMask { get; set; }
|
public ImageData CollisionMask { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the visual background image.
|
/// Gets or sets the visual background image.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Image Background { get; set; }
|
public ImageData Background { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets an image of unknown use.
|
/// Gets or sets an image of unknown use.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Image UnknownImage { get; set; }
|
public ImageData UnknownImage { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the path to the land image file.
|
/// Gets or sets the path to the land image file.
|
||||||
@ -122,10 +122,10 @@ namespace Syroot.Worms.Gen2.Worms2
|
|||||||
Unknown = reader.ReadInt32();
|
Unknown = reader.ReadInt32();
|
||||||
|
|
||||||
// Read the image data.
|
// Read the image data.
|
||||||
Foreground = reader.Load<Image>();
|
Foreground = reader.Load<ImageData>();
|
||||||
CollisionMask = reader.Load<Image>();
|
CollisionMask = reader.Load<ImageData>();
|
||||||
Background = reader.Load<Image>();
|
Background = reader.Load<ImageData>();
|
||||||
UnknownImage = reader.Load<Image>();
|
UnknownImage = reader.Load<ImageData>();
|
||||||
|
|
||||||
// Read the file paths.
|
// Read the file paths.
|
||||||
LandTexturePath = reader.ReadString(BinaryStringFormat.ByteLengthPrefix);
|
LandTexturePath = reader.ReadString(BinaryStringFormat.ByteLengthPrefix);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<AssemblyName>Syroot.Worms</AssemblyName>
|
<AssemblyName>Syroot.Worms</AssemblyName>
|
||||||
<AssemblyTitle>Worms</AssemblyTitle>
|
<AssemblyTitle>Worms</AssemblyTitle>
|
||||||
<Authors>Syroot</Authors>
|
<Authors>Syroot</Authors>
|
||||||
<VersionPrefix>1.0.0-alpha2</VersionPrefix>
|
<VersionPrefix>1.0.0-alpha3</VersionPrefix>
|
||||||
|
|
||||||
<PackageId>Syroot.Worms</PackageId>
|
<PackageId>Syroot.Worms</PackageId>
|
||||||
<PackageTags>worms;team17</PackageTags>
|
<PackageTags>worms;team17</PackageTags>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user