Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions RSDKv3/Backgrounds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class ScrollInfo
/// how fast the line moves while the player is moving, relative to 0x100.
/// E.G: 0x100 == move 1 pixel per 1 pixel of camera movement, 0x80 = 1 pixel every 2 pixels of camera movement, etc
/// </summary>
public short parallaxFactor = 0x100;
public ushort parallaxFactor = 0x100;

/// <summary>
/// How fast the line moves without the player moving
Expand All @@ -36,7 +36,7 @@ public float parallaxFactorF
}
set
{
parallaxFactor = (byte)(value * 256.0f);
parallaxFactor = (ushort)(value * 256.0f);
}
}

Expand Down Expand Up @@ -66,7 +66,7 @@ public ScrollInfo(Reader reader)
public void Read(Reader reader)
{
// 2 bytes, big-endian, unsigned
parallaxFactor = (short)(reader.ReadByte() << 8);
parallaxFactor = (ushort)(reader.ReadByte() << 8);
parallaxFactor |= reader.ReadByte();
scrollSpeed = reader.ReadByte();
deform = reader.ReadBoolean();
Expand Down Expand Up @@ -130,7 +130,7 @@ public enum LayerTypes
/// how fast the Layer moves while the player is moving, relative to 0x100.
/// E.G: 0x100 == move 1 pixel per 1 pixel of camera movement, 0x80 = 1 pixel every 2 pixels of camera movement, etc
/// </summary>
public short parallaxFactor = 0x100;
public ushort parallaxFactor = 0x100;

/// <summary>
/// how fast the layer moves while the player isn't moving
Expand All @@ -155,7 +155,7 @@ public float parallaxFactorF
}
set
{
parallaxFactor = (byte)(value * 256.0f);
parallaxFactor = (ushort)(value * 256.0f);
}
}

Expand Down Expand Up @@ -197,7 +197,7 @@ public void Read(Reader reader)
height = reader.ReadByte();
type = (LayerTypes)reader.ReadByte();

parallaxFactor = (short)(reader.ReadByte() << 8);
parallaxFactor = (ushort)(reader.ReadByte() << 8);
parallaxFactor |= reader.ReadByte();
scrollSpeed = reader.ReadByte();

Expand Down
12 changes: 6 additions & 6 deletions RSDKv4/Backgrounds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class ScrollInfo
/// how fast the line moves while the player is moving, relative to 0x100.
/// E.G: 0x100 == move 1 pixel per 1 pixel of camera movement, 0x80 = 1 pixel every 2 pixels of camera movement, etc
/// </summary>
public short parallaxFactor = 0x100;
public ushort parallaxFactor = 0x100;

/// <summary>
/// How fast the line moves without the player moving
Expand All @@ -36,7 +36,7 @@ public float parallaxFactorF
}
set
{
parallaxFactor = (byte)(value * 256.0f);
parallaxFactor = (ushort)(value * 256.0f);
}
}

Expand Down Expand Up @@ -67,7 +67,7 @@ public void Read(Reader reader)
{
// 2 bytes, little-endian, signed
parallaxFactor = reader.ReadByte();
parallaxFactor |= (short)(reader.ReadByte() << 8);
parallaxFactor |= (ushort)(reader.ReadByte() << 8);
scrollSpeed = reader.ReadByte();
deform = reader.ReadBoolean();
}
Expand Down Expand Up @@ -127,7 +127,7 @@ public enum LayerTypes
/// how fast the Layer moves while the player is moving, relative to 0x100.
/// E.G: 0x100 == move 1 pixel per 1 pixel of camera movement, 0x80 = 1 pixel every 2 pixels of camera movement, etc
/// </summary>
public short parallaxFactor = 0x100;
public ushort parallaxFactor = 0x100;
/// <summary>
/// how fast the layer moves while the player isn't moving
/// </summary>
Expand All @@ -151,7 +151,7 @@ public float parallaxFactorF
}
set
{
parallaxFactor = (byte)(value * 256.0f);
parallaxFactor = (ushort)(value * 256.0f);
}
}

Expand Down Expand Up @@ -199,7 +199,7 @@ public void Read(Reader reader)

// 2 bytes, little-endian, signed
parallaxFactor = reader.ReadByte();
parallaxFactor |= (short)(reader.ReadByte() << 8);
parallaxFactor |= (ushort)(reader.ReadByte() << 8);
scrollSpeed = reader.ReadByte();

lineScroll = new byte[height * 128];
Expand Down
4 changes: 2 additions & 2 deletions RSDKv4/DataPack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public void Read(Reader reader, List<NameIdentifier> fileNames = null, int fileI
reader.BaseStream.Position = fileOffset;

// Decrypt File if Encrypted
if (encrypted && !name.usingHash)
if (encrypted)
data = Decrypt(reader.ReadBytes(fileSize), false);
else
data = reader.ReadBytes(fileSize);
Expand Down Expand Up @@ -226,7 +226,7 @@ public void WriteFileHeader(Writer writer, uint offset = 0)

public void WriteFileData(Writer writer)
{
if (encrypted && !name.usingHash)
if (encrypted)
writer.Write(Decrypt(data, true));
else
writer.Write(data);
Expand Down