diff --git a/HaCreator/MapSimulator/MapSimulator.cs b/HaCreator/MapSimulator/MapSimulator.cs index 78dfecf4..d284dec7 100644 --- a/HaCreator/MapSimulator/MapSimulator.cs +++ b/HaCreator/MapSimulator/MapSimulator.cs @@ -307,16 +307,18 @@ protected override void LoadContent() foreach (BackgroundInstance background in mapBoard.BoardItems.BackBackgrounds) { WzImageProperty bgParent = (WzImageProperty)background.BaseInfo.ParentObject; + BackgroundItem bgItem = MapSimulatorLoader.CreateBackgroundFromProperty(texturePool, bgParent, background, _DxDeviceManager.GraphicsDevice, ref usedProps, background.Flip); - backgrounds_back.Add( - MapSimulatorLoader.CreateBackgroundFromProperty(texturePool, bgParent, background, _DxDeviceManager.GraphicsDevice, ref usedProps, background.Flip)); + if (bgItem != null) + backgrounds_back.Add(bgItem); } foreach (BackgroundInstance background in mapBoard.BoardItems.FrontBackgrounds) { WzImageProperty bgParent = (WzImageProperty)background.BaseInfo.ParentObject; + BackgroundItem bgItem = MapSimulatorLoader.CreateBackgroundFromProperty(texturePool, bgParent, background, _DxDeviceManager.GraphicsDevice, ref usedProps, background.Flip); - backgrounds_front.Add( - MapSimulatorLoader.CreateBackgroundFromProperty(texturePool, bgParent, background, _DxDeviceManager.GraphicsDevice, ref usedProps, background.Flip)); + if (bgItem != null) + backgrounds_front.Add(bgItem); } }); diff --git a/HaCreator/MapSimulator/MapSimulatorLoader.cs b/HaCreator/MapSimulator/MapSimulatorLoader.cs index bf4a494c..b1b2f136 100644 --- a/HaCreator/MapSimulator/MapSimulatorLoader.cs +++ b/HaCreator/MapSimulator/MapSimulatorLoader.cs @@ -23,6 +23,8 @@ using System.Linq; using System.Threading; using HaSharedLibrary.Wz; +using MapleLib.Helpers; +using SharpDX.Direct2D1.Effects; namespace HaCreator.MapSimulator { @@ -236,6 +238,14 @@ public static BaseDXDrawableItem CreateMapItemFromProperty(TexturePool texturePo public static BackgroundItem CreateBackgroundFromProperty(TexturePool texturePool, WzImageProperty source, BackgroundInstance bgInstance, GraphicsDevice device, ref List usedProps, bool flip) { List frames = LoadFrames(texturePool, source, bgInstance.BaseX, bgInstance.BaseY, device, ref usedProps, bgInstance.SpineAni); + if (frames.Count == 0) + { + string error = string.Format("[MapSimulatorLoader] 0 frames loaded for bg texture from src: '{0}'", source.FullPath); // Back_003.wz\\BM3_3.img\\spine\\0 + + ErrorLogger.Log(ErrorLevel.IncorrectStructure, error); + return null; + } + if (frames.Count == 1) { return new BackgroundItem(bgInstance.cx, bgInstance.cy, bgInstance.rx, bgInstance.ry, bgInstance.type, bgInstance.a, bgInstance.front, frames[0], flip, bgInstance.screenMode); @@ -357,7 +367,12 @@ public static ReactorItem CreateReactorFromProperty(TexturePool texturePool, Rea } } if (frames.Count == 0) + { + //string error = string.Format("[MapSimulatorLoader] 0 frames loaded for reactor from src: '{0}'", reactorInfo.ID); + + //ErrorLogger.Log(ErrorLevel.IncorrectStructure, error); return null; + } return new ReactorItem(reactorInstance, frames); } #endregion