mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 11:35:08 -04:00
Fix animations being cleared when joining another world with the same texture pack. (Thanks 123DontMessWitMe)
This commit is contained in:
parent
867e204825
commit
ea997f2eae
@ -91,7 +91,6 @@ namespace ClassicalSharp {
|
||||
|
||||
void DownloadTexturePack( string url ) {
|
||||
if( game.DeniedUrls.HasUrl( url ) ) return;
|
||||
game.Animations.Dispose();
|
||||
DateTime lastModified = TextureCache.GetLastModifiedFromCache( url );
|
||||
|
||||
if( url.Contains( ".zip" ) )
|
||||
@ -117,20 +116,24 @@ namespace ClassicalSharp {
|
||||
DownloadedItem item;
|
||||
if( game.AsyncDownloader.TryGetItem( "terrain", out item ) ) {
|
||||
if( item.Data != null ) {
|
||||
Bitmap bmp = (Bitmap)item.Data;
|
||||
Bitmap bmp = (Bitmap)item.Data;
|
||||
game.World.TextureUrl = item.Url;
|
||||
game.Animations.Dispose();
|
||||
|
||||
if( !FastBitmap.CheckFormat( bmp.PixelFormat ) ) {
|
||||
Utils.LogDebug( "Converting terrain atlas to 32bpp image" );
|
||||
game.Drawer2D.ConvertTo32Bpp( ref bmp );
|
||||
}
|
||||
game.ChangeTerrainAtlas( bmp );
|
||||
TextureCache.AddToCache( item.Url, bmp );
|
||||
game.World.TextureUrl = item.Url;
|
||||
TextureCache.AddToCache( item.Url, bmp );
|
||||
} else if( Is304Status( item.WebEx ) ) {
|
||||
Bitmap bmp = TextureCache.GetBitmapFromCache( item.Url );
|
||||
if( bmp == null ) // Should never happen, but handle anyways.
|
||||
if( bmp == null ) {// Should never happen, but handle anyways.
|
||||
ExtractDefault();
|
||||
else if( item.Url != game.World.TextureUrl )
|
||||
} else if( item.Url != game.World.TextureUrl ) {
|
||||
game.Animations.Dispose();
|
||||
game.ChangeTerrainAtlas( bmp );
|
||||
}
|
||||
|
||||
if( bmp != null ) game.World.TextureUrl = item.Url;
|
||||
} else {
|
||||
@ -140,15 +143,18 @@ namespace ClassicalSharp {
|
||||
|
||||
if( game.AsyncDownloader.TryGetItem( "texturePack", out item ) ) {
|
||||
if( item.Data != null ) {
|
||||
game.World.TextureUrl = item.Url;
|
||||
game.Animations.Dispose();
|
||||
|
||||
TexturePackExtractor extractor = new TexturePackExtractor();
|
||||
extractor.Extract( (byte[])item.Data, game );
|
||||
TextureCache.AddToCache( item.Url, (byte[])item.Data );
|
||||
game.World.TextureUrl = item.Url;
|
||||
TextureCache.AddToCache( item.Url, (byte[])item.Data );
|
||||
} else if( Is304Status( item.WebEx ) ) {
|
||||
byte[] data = TextureCache.GetDataFromCache( item.Url );
|
||||
if( data == null ) { // Should never happen, but handle anyways.
|
||||
ExtractDefault();
|
||||
} else if( item.Url != game.World.TextureUrl ) {
|
||||
game.Animations.Dispose();
|
||||
TexturePackExtractor extractor = new TexturePackExtractor();
|
||||
extractor.Extract( data, game );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user