From c2b18a913ee048c2bb18bc27668eb501e7388f4d Mon Sep 17 00:00:00 2001 From: biwa Date: Sun, 16 Jun 2019 18:40:10 +0200 Subject: [PATCH] - Fixed a bug where textures for internal model skin names did not load when "Path" was specified in MODELDEF --- Source/Core/GZBuilder/Data/ModelData.cs | 2 ++ Source/Core/GZBuilder/md3/ModelReader.cs | 7 ++++++- Source/Core/ZDoom/ModeldefParser.cs | 2 +- Source/Core/ZDoom/ModeldefStructure.cs | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Source/Core/GZBuilder/Data/ModelData.cs b/Source/Core/GZBuilder/Data/ModelData.cs index 52b0d01f..ff2f965e 100755 --- a/Source/Core/GZBuilder/Data/ModelData.cs +++ b/Source/Core/GZBuilder/Data/ModelData.cs @@ -37,6 +37,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data internal List> SurfaceSkinNames; internal List FrameNames; internal List FrameIndices; + internal string Path; // biwa internal GZModel Model; @@ -71,6 +72,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data SurfaceSkinNames = new List>(); FrameNames = new List(); FrameIndices = new List(); + Path = string.Empty; transform = Matrix.Identity; transformstretched = Matrix.Identity; hashcode = hashcounter++; diff --git a/Source/Core/GZBuilder/md3/ModelReader.cs b/Source/Core/GZBuilder/md3/ModelReader.cs index 79ba3c95..87ab34ad 100755 --- a/Source/Core/GZBuilder/md3/ModelReader.cs +++ b/Source/Core/GZBuilder/md3/ModelReader.cs @@ -185,7 +185,12 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3 continue; } - Texture t = GetTexture(containers, result.Skins[m], device); + string path = result.Skins[m].Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar); + + if(!String.IsNullOrEmpty(mde.Path)) + path = Path.Combine(mde.Path, path); + + Texture t = GetTexture(containers, path, device); if(t == null) { diff --git a/Source/Core/ZDoom/ModeldefParser.cs b/Source/Core/ZDoom/ModeldefParser.cs index a799d857..7bd1a821 100755 --- a/Source/Core/ZDoom/ModeldefParser.cs +++ b/Source/Core/ZDoom/ModeldefParser.cs @@ -187,7 +187,7 @@ namespace CodeImp.DoomBuilder.ZDoom if(mds.Frames.ContainsKey(targetsprite)) { // Create model data - ModelData md = new ModelData { InheritActorPitch = mds.InheritActorPitch, UseActorPitch = mds.UseActorPitch, UseActorRoll = mds.UseActorRoll }; + ModelData md = new ModelData { InheritActorPitch = mds.InheritActorPitch, UseActorPitch = mds.UseActorPitch, UseActorRoll = mds.UseActorRoll, Path = mds.DataPath }; // Things are complicated in GZDoom... Matrix moffset = Matrix.Translation(mds.Offset.Y, -mds.Offset.X, mds.Offset.Z); diff --git a/Source/Core/ZDoom/ModeldefStructure.cs b/Source/Core/ZDoom/ModeldefStructure.cs index af171e2f..40fe2ca8 100755 --- a/Source/Core/ZDoom/ModeldefStructure.cs +++ b/Source/Core/ZDoom/ModeldefStructure.cs @@ -63,6 +63,7 @@ namespace CodeImp.DoomBuilder.ZDoom public bool InheritActorPitch { get { return inheritactorpitch; } } public bool UseActorPitch { get { return useactorpitch; } } public bool UseActorRoll { get { return useactorroll; } } + public string DataPath { get { return path; } } // biwa public Dictionary> Frames { get { return frames; } }