Compare commits

...

4 Commits

2 changed files with 29 additions and 19 deletions

View File

@ -147,38 +147,40 @@ public class ResourcePathManager
throw new InvalidOperationException("Failed to find all installation config paths.");
}
// Get the paths of the base Fam and Obj resources so we can extract them.
// We need to know where all the texture and object resources are
var installCfgLines = File.ReadAllLines(configPaths[(int)ConfigFile.Install]);
FindConfigVar(installCfgLines, "resname_base", out var resPaths);
var baseFamPath = "";
var baseObjPath = "";
if (!FindConfigVar(installCfgLines, "resname_base", out var resPaths))
{
throw new InvalidOperationException("Failed to find resnames in install config");
}
var zipPaths = new List<string>();
foreach (var resPath in resPaths.Split('+'))
{
var dir = Path.Join(installPath, ConvertSeparator(resPath));
if (!Directory.Exists(dir))
{
continue;
}
foreach (var path in Directory.GetFiles(dir))
{
var name = Path.GetFileName(path).ToLower();
if (name == "fam.crf" && baseFamPath == "")
if (name is "fam.crf" or "obj.crf")
{
baseFamPath = path;
}
else if (name == "obj.crf" && baseObjPath == "")
{
baseObjPath = path;
zipPaths.Add(path);
}
}
}
// Do the extraction bro
(string, string)[] resources = [("fam", baseFamPath), ("obj", baseObjPath)];
foreach (var (extractName, zipPath) in resources)
// The path order is a priority order, so we don't want to overwrite any files when extracting
// TODO: Check if there's any problems caused by case sensitivity
foreach (var zipPath in zipPaths)
{
var extractPath = Path.Join(_extractionPath, extractName);
if (Directory.Exists(extractPath))
{
Directory.Delete(extractPath, true);
}
ZipFile.OpenRead(zipPath).ExtractToDirectory(extractPath);
var resType = Path.GetFileNameWithoutExtension(zipPath);
var extractPath = Path.Join(_extractionPath, resType);
ZipFile.OpenRead(zipPath).ExtractToDirectory(extractPath, false);
}
FindConfigVar(installCfgLines, "load_path", out var omsPath);

View File

@ -92,7 +92,15 @@ public class LightMapper
Timing.TimeStage("Trace Scene", () => TraceScene(settings));
Timing.TimeStage("Update AnimLight Cell Mapping", SetAnimLightCellMaps);
// lmParams.ShadowType = LmParams.LightingMode.Raycast;
// We always do object casting, so it's nice to let dromed know that :)
lmParams.ShadowType = LmParams.LightingMode.Objcast;
if (rendParams is { useSunlight: true, sunlightMode: RendParams.SunlightMode.SingleUnshadowed })
{
rendParams.sunlightMode = RendParams.SunlightMode.SingleObjcastShadows;
} else if (rendParams is { useSunlight: true, sunlightMode: RendParams.SunlightMode.QuadUnshadowed })
{
rendParams.sunlightMode = RendParams.SunlightMode.QuadObjcastShadows;
}
}
public void Save(string missionName)