Skip to content

Commit 0c924f5

Browse files
Fixed a typo in Chunk Model Data Editor and edited the RingGroup object definition for SA2.
-Chunk Model Data Editor: Removed an unnecessary conditional that caused the Flip U flag to not appear in the strip flags list. -SET Editing: Added the "GetTexturesMultiSource" function, which grants the ability to use multiple texture pack sources for SET objects; this is vital for properly displaying SA2 SET objects. -SA2 Object Definitions: --RingGroup: Edited the calculations for ring displacements in both the RingLinear and RingCircle classes. The Switch and Mystic Melody variants now have an added "Shrine/Switch ID" property that can be changed, and the default displacement for the rings has been modified to start at 10. ---RingLinear: Ring lines now have proper rotations and have their sine wave-like displacements applied.
1 parent 56d07b2 commit 0c924f5

File tree

3 files changed

+525
-27
lines changed

3 files changed

+525
-27
lines changed

Libraries/SAEditorCommon/SETEditing/ObjectHelper.cs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using System.Linq;
99
using Color = System.Drawing.Color;
1010
using Mesh = SAModel.Direct3D.Mesh;
11+
using SAModel.Direct3D.TextureSystem;
1112

1213
namespace SAModel.SAEditorCommon.SETEditing
1314
{
@@ -85,6 +86,50 @@ public static Texture[] GetTextures(string name, SplitTools.NJS_TEXLIST texnames
8586
return texlist.ToArray();
8687
}
8788
}
89+
// This is primarily used for SA2 level objects that pull from multiple texture sources.
90+
// Copied from pieces of SAMDL's code.
91+
public static Texture[] GetTexturesMultiSource(List<string> name, SplitTools.NJS_TEXLIST texnames = null, Device dev = null)
92+
{
93+
Texture[] result = null;
94+
if (texnames == null)
95+
return result;
96+
else
97+
{
98+
List<BMPInfo> texturedata = new List<BMPInfo>();
99+
Direct3D.TextureSystem.BMPInfo[] texturebmps = null;
100+
if (texturebmps != null && texturebmps.Length > 0)
101+
texturedata.AddRange(texturebmps);
102+
for (int i = 0; i < name.Count; i++)
103+
{
104+
if (LevelData.TextureBitmaps.ContainsKey(name[i]))
105+
texturedata.AddRange(LevelData.TextureBitmaps[name[i]]);
106+
else if (LevelData.TextureBitmaps.ContainsKey(name[i].ToUpperInvariant()))
107+
texturedata.AddRange(LevelData.TextureBitmaps[name[i].ToUpperInvariant()]);
108+
else if (LevelData.TextureBitmaps.ContainsKey(name[i].ToLowerInvariant()))
109+
texturedata.AddRange(LevelData.TextureBitmaps[name[i].ToLowerInvariant()]);
110+
}
111+
texturebmps = texturedata.ToArray();
112+
if (LevelData.TextureBitmaps == null || dev == null)
113+
return result;
114+
List<Texture> texlist = new List<Texture>();
115+
List<BMPInfo> texinfo = new List<BMPInfo>();
116+
List<string> dupnames = new List<string>();
117+
for (int i = 0; i < texnames.TextureNames.Length; i++)
118+
{
119+
for (int b = 0; b < texturebmps.Length; b++)
120+
{
121+
if (string.IsNullOrEmpty(texnames.TextureNames[i]) || (texnames.TextureNames[i].ToLowerInvariant() == texturebmps[b].Name.ToLowerInvariant() && !dupnames.Contains(texnames.TextureNames[i].ToLowerInvariant())))
122+
{
123+
texinfo.Add(texturebmps[b]);
124+
texlist.Add(texturebmps[b].Image.ToTexture(dev));
125+
dupnames.Add(texturebmps[b].Name.ToLowerInvariant());
126+
continue;
127+
}
128+
}
129+
}
130+
return texlist.ToArray();
131+
}
132+
}
88133

89134
public static HitResult CheckQuestionBoxHit(Vector3 Near, Vector3 Far, Viewport Viewport, Matrix Projection, Matrix View, MatrixStack transform)
90135
{

Libraries/SAEditorCommon/UI/ChunkModelDataEditor.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,6 @@ private void BuildPolyChunkList()
638638
clamp += pct.ClampV ? "V" : "";
639639
if (pct.ClampU || pct.ClampV)
640640
texdata += clamp + " )";
641-
if (!pct.ClampU && !pct.ClampV)
642641
flip += pct.FlipU ? "U" : "";
643642
flip += pct.FlipV ? "V" : "";
644643
if (pct.FlipU || pct.FlipV)

0 commit comments

Comments
 (0)