Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,16 @@ public override void LoadTilesets(string[] tilesetnames)
foreach (var t in tilesetnames)
{
var realFilename = tilesetFiles.FirstOrDefault(file => t.Equals(file, StringComparison.InvariantCultureIgnoreCase)) ?? t;
var assetName = Path.Combine(ClientConfiguration.ResourcesDirectory, "tilesets", t.ToLower()).Replace('\\', '/');
if (!string.IsNullOrWhiteSpace(t) &&
(!string.IsNullOrWhiteSpace(realFilename) ||
AtlasReference.TryGet(Path.Combine(ClientConfiguration.ResourcesDirectory, "tilesets", t.ToLower()), out _) != null) &&
AtlasReference.TryGet(assetName, out _)) &&
!mTilesetDict.ContainsKey(t.ToLower()))
{
mTilesetDict.Add(
t.ToLower(),
Core.Graphics.Renderer.LoadTexture(
Path.Combine(ClientConfiguration.ResourcesDirectory, "tilesets", t),
assetName,
Path.Combine(ClientConfiguration.ResourcesDirectory, "tilesets", realFilename)
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,13 @@ AtlasReference atlasReference
{
}

public override int Width => PlatformTexture?.Width ?? 0;
public override int Width => AtlasReference?.IsRotated == true
? AtlasReference.Bounds.Height
: AtlasReference?.Bounds.Width ?? PlatformTexture?.Width ?? 0;

public override int Height => PlatformTexture?.Height ?? 0;
public override int Height => AtlasReference?.IsRotated == true
? AtlasReference.Bounds.Width
: AtlasReference?.Bounds.Height ?? PlatformTexture?.Height ?? 0;

protected override Texture2D? CreatePlatformTextureFromStream(Stream stream)
{
Expand Down
5 changes: 3 additions & 2 deletions Intersect.Client.Framework/Graphics/AtlasReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public static AtlasReference[] GetAllFor(string folderName)

public static bool TryGet(string assetName, [NotNullWhen(true)] out AtlasReference? atlasReference)
{
return _atlasReferences.TryGetValue(assetName, out atlasReference) ||
_atlasReferences.TryGetValue(assetName.ToLowerInvariant(), out atlasReference);
var normalizedAssetName = assetName.Replace('\\', '/');
return _atlasReferences.TryGetValue(normalizedAssetName, out atlasReference) ||
_atlasReferences.TryGetValue(normalizedAssetName.ToLowerInvariant(), out atlasReference);
}
}
6 changes: 6 additions & 0 deletions Intersect.Client.Framework/Graphics/GameTexture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,12 @@ private void LoadPlatformTexture(bool force = false)
}

atlasTexture.LoadPlatformTexture(force);
IsMissingOrCorrupt = atlasTexture.IsMissingOrCorrupt;
if (!IsMissingOrCorrupt)
{
UpdateAccessTime();
EmitLoaded();
}
return;
}

Expand Down
4 changes: 2 additions & 2 deletions Intersect.Client.Framework/Gwen/Skin/Texturing/Bordered.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Intersect.Client.Framework.GenericClasses;
using Intersect.Client.Framework.GenericClasses;
using Intersect.Client.Framework.Graphics;

namespace Intersect.Client.Framework.Gwen.Skin.Texturing;
Expand Down Expand Up @@ -185,7 +185,7 @@ public void Draw(Renderer.Base render, Rectangle r, Color col)

public bool Equals(Bordered other)
{
return _texture.Equals(other._texture) && _subRects.Equals(other._subRects) && _margin.Equals(other._margin) && _width.Equals(other._width) && _height.Equals(other._height);
return (_texture?.Equals(other._texture) ?? false) && _subRects.Equals(other._subRects) && _margin.Equals(other._margin) && _width.Equals(other._width) && _height.Equals(other._height);
}

public override bool Equals(object? obj)
Expand Down
Loading