Skip to content

Commit

Permalink
[HaCreator] fix map simulator rendering issues for reactors without a…
Browse files Browse the repository at this point in the history
…ny frames
  • Loading branch information
lastbattle committed Dec 14, 2022
1 parent 6853e8a commit 7c3aee3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion HaCreator/MapSimulator/MapSimulator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,8 @@ protected override void LoadContent()
//WzImage imageProperty = (WzImage)NPCWZFile[reactorInfo.ID + ".img"];
ReactorItem reactorItem = MapSimulatorLoader.CreateReactorFromProperty(texturePool, reactor, _DxDeviceManager.GraphicsDevice, ref usedProps);
mapObjects_Reactors.Add(reactorItem);
if (reactorItem != null)
mapObjects_Reactors.Add(reactorItem);
}
});

Expand Down
13 changes: 8 additions & 5 deletions HaCreator/MapSimulator/MapSimulatorLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -344,14 +344,17 @@ private static bool LoadSpineMapObjectItem(WzImageProperty source, WzImageProper
public static ReactorItem CreateReactorFromProperty(TexturePool texturePool, ReactorInstance reactorInstance, GraphicsDevice device, ref List<WzObject> usedProps)
{
ReactorInfo reactorInfo = (ReactorInfo)reactorInstance.BaseInfo;
WzImage linkedReactorImage = reactorInfo.LinkedWzImage;


List<IDXObject> frames = new List<IDXObject>();

WzImageProperty framesImage = (WzImageProperty) linkedReactorImage["0"]?["0"];
if (framesImage != null)
WzImage linkedReactorImage = reactorInfo.LinkedWzImage;
if (linkedReactorImage != null)
{
frames = LoadFrames(texturePool, framesImage, reactorInstance.X, reactorInstance.Y, device, ref usedProps);
WzImageProperty framesImage = (WzImageProperty)linkedReactorImage?["0"]?["0"];
if (framesImage != null)
{
frames = LoadFrames(texturePool, framesImage, reactorInstance.X, reactorInstance.Y, device, ref usedProps);
}
}
if (frames.Count == 0)
return null;
Expand Down

0 comments on commit 7c3aee3

Please sign in to comment.