From 3690fafb27de2807d9d62f636727925b3d290049 Mon Sep 17 00:00:00 2001 From: Crt Vavros <4377556+smlu@users.noreply.github.com> Date: Sat, 6 Jul 2024 20:51:38 +0200 Subject: [PATCH] Add support for Indiana Jones game && Refactor & Add new feature Changes: - Adds support for game Indiana Jones and the Infernal Machine - Adds virtual file system (VFS) for loading game assets from bundle files (GOB) and from file system - Refactors and restructures code: adds sith modules, loading of full level mesh, etc. - Adds editor menu to load level directly into editor (SithEditor.cs) - Adds new shaders that replicate the original engine rendering (diffuse, gouraud) and shader for rendering ceiling sky - Implements original triangulation algorithm - Adds support for 16 & 32 bit MAT files - Adds support for v2.3 3DO files - Refactors texture caching - Implements loading of sprites - Fixes imported Thing & 3DO node orientation - Adds in-editor gizmos for Things without visual representation - Adds options to edit some of the level components in editor (e.g.: change sector light) --- .gitignore | 77 +- .vscode/launch.json | 38 - .vscode/settings.json | 56 -- Assets/DeactivateLights.cs | 30 + ...nager.cs.meta => DeactivateLights.cs.meta} | 2 +- Assets/Editor/SithEditor.cs | 79 +- Assets/ExportMaterial.cs | 65 ++ ...YParser.cs.meta => ExportMaterial.cs.meta} | 4 +- Assets/ImportMaterial.cs | 51 + ...yerJump.cs.meta => ImportMaterial.cs.meta} | 4 +- Assets/New Shader Graph.shadergraph | 658 +++++++++++++ Assets/New Shader Graph.shadergraph.meta | 10 + Assets/PlayerController/PlayerJump.cs | 27 - Assets/PlayerController/PlayerMouselook.cs | 38 - Assets/PlayerController/PlayerMovement.cs | 54 - Assets/PlayerController/step.wav | Bin 23894 -> 0 bytes Assets/PlayerController/step.wav.meta | 24 - Assets/RepeatingAtlas.shader | 61 -- Assets/RepeatingAtlasStandard.shader | 64 -- Assets/Resources.meta | 8 + Assets/Resources/BillingMode.json | 1 + Assets/Resources/BillingMode.json.meta | 7 + Assets/Scene.unity | Bin 18504 -> 17588 bytes Assets/Scripts.meta | 2 +- Assets/Scripts/GOBManager.cs | 66 -- Assets/Scripts/GOBStream.cs.meta | 12 - Assets/Scripts/JKL/JKLParser.cs | 541 ---------- Assets/Scripts/JKL/Material.cs | 14 - Assets/Scripts/JKL/Material.cs.meta | 12 - Assets/Scripts/KEYParser.cs | 188 ---- Assets/Scripts/MATParser.cs | 133 --- Assets/Scripts/MATParser.cs.meta | 12 - Assets/Scripts/MovePlayer.cs | 52 - Assets/Scripts/Sith.cs | 343 ------- Assets/Scripts/SmackerPlayerRenderer.cs | 51 - Assets/Scripts/_3DOLoader.cs.meta | 12 - Assets/Scripts/test.anim | Bin 14880 -> 0 bytes Assets/Scripts/test.anim.meta | 10 - Assets/Shaders.meta | 8 + Assets/Shaders/BaseShader.cginc | 129 +++ Assets/Shaders/BaseShader.cginc.meta | 7 + Assets/Shaders/SithCeilingSky.shader | 46 + .../SithCeilingSky.shader.meta} | 5 +- Assets/Shaders/SithTexture.shader | 47 + .../SithTexture.shader.meta} | 6 +- Assets/Shaders/SithTransparent.shader | 64 ++ Assets/Shaders/SithTransparent.shader.meta | 10 + Assets/Sith.meta | 9 + Assets/Sith/Content.meta | 8 + Assets/Sith/Content/AssetStore.cs | 167 ++++ Assets/Sith/Content/AssetStore.cs.meta | 11 + Assets/Sith/Content/ISithAsset.cs | 13 + Assets/Sith/Content/ISithAsset.cs.meta | 11 + Assets/{Scripts => Sith/Content}/JKL.meta | 0 Assets/{Scripts => Sith/Content}/JKL/JKL.cs | 31 +- .../{Scripts => Sith/Content}/JKL/JKL.cs.meta | 0 Assets/Sith/Content/JKL/JKLParser.cs | 925 ++++++++++++++++++ .../Content}/JKL/JKLParser.cs.meta | 0 Assets/Sith/Content/KEY.cs | 209 ++++ Assets/Sith/Content/KEY.cs.meta | 11 + Assets/Sith/Content/MAT.cs | 276 ++++++ Assets/Sith/Content/MAT.cs.meta | 11 + .../Content/Model3DO.cs} | 190 ++-- Assets/Sith/Content/Model3DO.cs.meta | 11 + .../{Scripts => Sith/Content}/PUPPETParser.cs | 10 +- .../Content}/PUPPETParser.cs.meta | 2 +- Assets/Sith/Content/Primitives.meta | 8 + Assets/Sith/Content/Primitives/RdFace.cs | 12 + Assets/Sith/Content/Primitives/RdFace.cs.meta | 11 + Assets/Sith/Content/SPR.cs | 89 ++ Assets/Sith/Content/SPR.cs.meta | 11 + .../Content}/SmackerPlayer.cs | 4 +- .../Content}/SmackerPlayer.cs.meta | 4 +- Assets/Sith/Content/SmackerPlayerRenderer.cs | 54 + .../Content}/SmackerPlayerRenderer.cs.meta | 4 +- Assets/Sith/Game.meta | 8 + Assets/Sith/Game/Player.meta | 8 + Assets/Sith/Game/Player/MovePlayer.cs | 60 ++ .../Game/Player}/MovePlayer.cs.meta | 0 .../Game/Player}/MoveSlideCapsule.cs | 14 +- .../Game/Player}/MoveSlideCapsule.cs.meta | 0 Assets/Sith/Game/Player/PlayerMouselook.cs | 108 ++ .../Game/Player}/PlayerMouselook.cs.meta | 0 Assets/Sith/Game/Player/PlayerMovement.cs | 154 +++ .../Game/Player}/PlayerMovement.cs.meta | 4 +- .../Game/Player/PlayerMovementCharacter.cs | 99 ++ .../Player/PlayerMovementCharacter.cs.meta | 11 + Assets/Sith/Game/Sith.cs | 68 ++ Assets/{Scripts => Sith/Game}/Sith.cs.meta | 0 Assets/Sith/Game/Thing.meta | 8 + Assets/Sith/Game/Thing/SithThing.cs | 55 ++ Assets/Sith/Game/Thing/SithThing.cs.meta | 11 + Assets/Sith/Game/Thing/ThingGizmo.cs | 26 + Assets/Sith/Game/Thing/ThingGizmo.cs.meta | 11 + Assets/Sith/Game/World.meta | 8 + Assets/Sith/Game/World/SithSector.cs | 256 +++++ Assets/Sith/Game/World/SithSector.cs.meta | 11 + Assets/Sith/Game/World/SithSurface.cs | 166 ++++ Assets/Sith/Game/World/SithSurface.cs.meta | 11 + Assets/Sith/Game/World/SithWorld.cs | 709 ++++++++++++++ Assets/Sith/Game/World/SithWorld.cs.meta | 11 + Assets/Sith/Gui.meta | 8 + Assets/Sith/Gui/BoundsMinMaxViewAttribute.cs | 47 + .../Gui/BoundsMinMaxViewAttribute.cs.meta | 11 + Assets/Sith/Gui/ConditionalHideAttribute.cs | 88 ++ .../Sith/Gui/ConditionalHideAttribute.cs.meta | 11 + Assets/Sith/Gui/HexFieldAttribute.cs | 90 ++ Assets/Sith/Gui/HexFieldAttribute.cs.meta | 11 + Assets/Sith/Gui/NotifyAttribute.cs | 48 + Assets/Sith/Gui/NotifyAttribute.cs.meta | 11 + Assets/Sith/Gui/ReadOnlyAttribute.cs | 32 + Assets/Sith/Gui/ReadOnlyAttribute.cs.meta | 11 + Assets/Sith/Utility.meta | 8 + Assets/Sith/Utility/Extensions.cs | 142 +++ Assets/Sith/Utility/Extensions.cs.meta | 11 + Assets/Sith/Utility/Range.cs | 17 + Assets/Sith/Utility/Range.cs.meta | 11 + Assets/Sith/Utility/Singleton.cs | 21 + Assets/Sith/Utility/Singleton.cs.meta | 11 + Assets/Sith/Utility/Utils.cs | 88 ++ Assets/Sith/Utility/Utils.cs.meta | 11 + Assets/Sith/Vfs.meta | 8 + Assets/{Scripts => Sith/Vfs}/GOBStream.cs | 6 +- Assets/Sith/Vfs/GOBStream.cs.meta | 11 + Assets/{Scripts => Sith/Vfs}/PartStream.cs | 2 +- .../{Scripts => Sith/Vfs}/PartStream.cs.meta | 0 Assets/Sith/Vfs/VirtualFileSystem.cs | 140 +++ Assets/Sith/Vfs/VirtualFileSystem.cs.meta | 11 + Assets/StandardMaterial.mat | Bin 5036 -> 0 bytes Assets/StandardMaterial.mat.meta | 8 - Directory.Build.props | 7 + Directory.Build.targets | 7 + Packages/manifest.json | 22 +- Packages/packages-lock.json | 408 ++++++++ ProjectSettings/DynamicsManager.asset | Bin 4282 -> 4364 bytes ProjectSettings/InputManager.asset | Bin 5516 -> 5512 bytes ProjectSettings/MemorySettings.asset | 35 + ProjectSettings/PackageManagerSettings.asset | 43 + ProjectSettings/ProjectSettings.asset | Bin 66320 -> 69674 bytes ProjectSettings/ProjectVersion.txt | 4 +- ProjectSettings/SceneTemplateSettings.json | 121 +++ ProjectSettings/URPProjectSettings.asset | 15 + ProjectSettings/VersionControlSettings.asset | 8 + 143 files changed, 6636 insertions(+), 1945 deletions(-) delete mode 100644 .vscode/launch.json delete mode 100644 .vscode/settings.json create mode 100644 Assets/DeactivateLights.cs rename Assets/{Scripts/GOBManager.cs.meta => DeactivateLights.cs.meta} (83%) create mode 100644 Assets/ExportMaterial.cs rename Assets/{Scripts/KEYParser.cs.meta => ExportMaterial.cs.meta} (71%) create mode 100644 Assets/ImportMaterial.cs rename Assets/{PlayerController/PlayerJump.cs.meta => ImportMaterial.cs.meta} (71%) create mode 100644 Assets/New Shader Graph.shadergraph create mode 100644 Assets/New Shader Graph.shadergraph.meta delete mode 100644 Assets/PlayerController/PlayerJump.cs delete mode 100644 Assets/PlayerController/PlayerMouselook.cs delete mode 100644 Assets/PlayerController/PlayerMovement.cs delete mode 100644 Assets/PlayerController/step.wav delete mode 100644 Assets/PlayerController/step.wav.meta delete mode 100644 Assets/RepeatingAtlas.shader delete mode 100644 Assets/RepeatingAtlasStandard.shader create mode 100644 Assets/Resources.meta create mode 100644 Assets/Resources/BillingMode.json create mode 100644 Assets/Resources/BillingMode.json.meta delete mode 100644 Assets/Scripts/GOBManager.cs delete mode 100644 Assets/Scripts/GOBStream.cs.meta delete mode 100644 Assets/Scripts/JKL/JKLParser.cs delete mode 100644 Assets/Scripts/JKL/Material.cs delete mode 100644 Assets/Scripts/JKL/Material.cs.meta delete mode 100644 Assets/Scripts/KEYParser.cs delete mode 100644 Assets/Scripts/MATParser.cs delete mode 100644 Assets/Scripts/MATParser.cs.meta delete mode 100644 Assets/Scripts/MovePlayer.cs delete mode 100644 Assets/Scripts/Sith.cs delete mode 100644 Assets/Scripts/SmackerPlayerRenderer.cs delete mode 100644 Assets/Scripts/_3DOLoader.cs.meta delete mode 100644 Assets/Scripts/test.anim delete mode 100644 Assets/Scripts/test.anim.meta create mode 100644 Assets/Shaders.meta create mode 100644 Assets/Shaders/BaseShader.cginc create mode 100644 Assets/Shaders/BaseShader.cginc.meta create mode 100644 Assets/Shaders/SithCeilingSky.shader rename Assets/{RepeatingAtlas.shader.meta => Shaders/SithCeilingSky.shader.meta} (62%) create mode 100644 Assets/Shaders/SithTexture.shader rename Assets/{RepeatingAtlasStandard.shader.meta => Shaders/SithTexture.shader.meta} (59%) create mode 100644 Assets/Shaders/SithTransparent.shader create mode 100644 Assets/Shaders/SithTransparent.shader.meta create mode 100644 Assets/Sith.meta create mode 100644 Assets/Sith/Content.meta create mode 100644 Assets/Sith/Content/AssetStore.cs create mode 100644 Assets/Sith/Content/AssetStore.cs.meta create mode 100644 Assets/Sith/Content/ISithAsset.cs create mode 100644 Assets/Sith/Content/ISithAsset.cs.meta rename Assets/{Scripts => Sith/Content}/JKL.meta (100%) rename Assets/{Scripts => Sith/Content}/JKL/JKL.cs (61%) rename Assets/{Scripts => Sith/Content}/JKL/JKL.cs.meta (100%) create mode 100644 Assets/Sith/Content/JKL/JKLParser.cs rename Assets/{Scripts => Sith/Content}/JKL/JKLParser.cs.meta (100%) create mode 100644 Assets/Sith/Content/KEY.cs create mode 100644 Assets/Sith/Content/KEY.cs.meta create mode 100644 Assets/Sith/Content/MAT.cs create mode 100644 Assets/Sith/Content/MAT.cs.meta rename Assets/{Scripts/_3DOLoader.cs => Sith/Content/Model3DO.cs} (56%) create mode 100644 Assets/Sith/Content/Model3DO.cs.meta rename Assets/{Scripts => Sith/Content}/PUPPETParser.cs (89%) rename Assets/{Scripts => Sith/Content}/PUPPETParser.cs.meta (83%) create mode 100644 Assets/Sith/Content/Primitives.meta create mode 100644 Assets/Sith/Content/Primitives/RdFace.cs create mode 100644 Assets/Sith/Content/Primitives/RdFace.cs.meta create mode 100644 Assets/Sith/Content/SPR.cs create mode 100644 Assets/Sith/Content/SPR.cs.meta rename Assets/{Scripts => Sith/Content}/SmackerPlayer.cs (99%) rename Assets/{Scripts => Sith/Content}/SmackerPlayer.cs.meta (71%) create mode 100644 Assets/Sith/Content/SmackerPlayerRenderer.cs rename Assets/{Scripts => Sith/Content}/SmackerPlayerRenderer.cs.meta (71%) create mode 100644 Assets/Sith/Game.meta create mode 100644 Assets/Sith/Game/Player.meta create mode 100644 Assets/Sith/Game/Player/MovePlayer.cs rename Assets/{Scripts => Sith/Game/Player}/MovePlayer.cs.meta (100%) rename Assets/{Scripts => Sith/Game/Player}/MoveSlideCapsule.cs (89%) rename Assets/{Scripts => Sith/Game/Player}/MoveSlideCapsule.cs.meta (100%) create mode 100644 Assets/Sith/Game/Player/PlayerMouselook.cs rename Assets/{PlayerController => Sith/Game/Player}/PlayerMouselook.cs.meta (100%) create mode 100644 Assets/Sith/Game/Player/PlayerMovement.cs rename Assets/{PlayerController => Sith/Game/Player}/PlayerMovement.cs.meta (71%) create mode 100644 Assets/Sith/Game/Player/PlayerMovementCharacter.cs create mode 100644 Assets/Sith/Game/Player/PlayerMovementCharacter.cs.meta create mode 100644 Assets/Sith/Game/Sith.cs rename Assets/{Scripts => Sith/Game}/Sith.cs.meta (100%) create mode 100644 Assets/Sith/Game/Thing.meta create mode 100644 Assets/Sith/Game/Thing/SithThing.cs create mode 100644 Assets/Sith/Game/Thing/SithThing.cs.meta create mode 100644 Assets/Sith/Game/Thing/ThingGizmo.cs create mode 100644 Assets/Sith/Game/Thing/ThingGizmo.cs.meta create mode 100644 Assets/Sith/Game/World.meta create mode 100644 Assets/Sith/Game/World/SithSector.cs create mode 100644 Assets/Sith/Game/World/SithSector.cs.meta create mode 100644 Assets/Sith/Game/World/SithSurface.cs create mode 100644 Assets/Sith/Game/World/SithSurface.cs.meta create mode 100644 Assets/Sith/Game/World/SithWorld.cs create mode 100644 Assets/Sith/Game/World/SithWorld.cs.meta create mode 100644 Assets/Sith/Gui.meta create mode 100644 Assets/Sith/Gui/BoundsMinMaxViewAttribute.cs create mode 100644 Assets/Sith/Gui/BoundsMinMaxViewAttribute.cs.meta create mode 100644 Assets/Sith/Gui/ConditionalHideAttribute.cs create mode 100644 Assets/Sith/Gui/ConditionalHideAttribute.cs.meta create mode 100644 Assets/Sith/Gui/HexFieldAttribute.cs create mode 100644 Assets/Sith/Gui/HexFieldAttribute.cs.meta create mode 100644 Assets/Sith/Gui/NotifyAttribute.cs create mode 100644 Assets/Sith/Gui/NotifyAttribute.cs.meta create mode 100644 Assets/Sith/Gui/ReadOnlyAttribute.cs create mode 100644 Assets/Sith/Gui/ReadOnlyAttribute.cs.meta create mode 100644 Assets/Sith/Utility.meta create mode 100644 Assets/Sith/Utility/Extensions.cs create mode 100644 Assets/Sith/Utility/Extensions.cs.meta create mode 100644 Assets/Sith/Utility/Range.cs create mode 100644 Assets/Sith/Utility/Range.cs.meta create mode 100644 Assets/Sith/Utility/Singleton.cs create mode 100644 Assets/Sith/Utility/Singleton.cs.meta create mode 100644 Assets/Sith/Utility/Utils.cs create mode 100644 Assets/Sith/Utility/Utils.cs.meta create mode 100644 Assets/Sith/Vfs.meta rename Assets/{Scripts => Sith/Vfs}/GOBStream.cs (95%) create mode 100644 Assets/Sith/Vfs/GOBStream.cs.meta rename Assets/{Scripts => Sith/Vfs}/PartStream.cs (98%) rename Assets/{Scripts => Sith/Vfs}/PartStream.cs.meta (100%) create mode 100644 Assets/Sith/Vfs/VirtualFileSystem.cs create mode 100644 Assets/Sith/Vfs/VirtualFileSystem.cs.meta delete mode 100644 Assets/StandardMaterial.mat delete mode 100644 Assets/StandardMaterial.mat.meta create mode 100644 Directory.Build.props create mode 100644 Directory.Build.targets create mode 100644 Packages/packages-lock.json create mode 100644 ProjectSettings/MemorySettings.asset create mode 100644 ProjectSettings/PackageManagerSettings.asset create mode 100644 ProjectSettings/SceneTemplateSettings.json create mode 100644 ProjectSettings/URPProjectSettings.asset create mode 100644 ProjectSettings/VersionControlSettings.asset diff --git a/.gitignore b/.gitignore index cef7dc8..37dba55 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,81 @@ .vs/ +.vscode/ +.vsconfig Library/ obj/ Temp/ *.csproj -*.suo -*.sln +*.suo*.sln + jkedit/ -Extracted/ \ No newline at end of file +Extracted/ + +/[Ll]ibrary/ +/[Tt]emp/ +/[Oo]bj/ +/[Bb]uild/ +/[Bb]uilds/ +/[Ll]ogs/ +/[Uu]ser[Ss]ettings/ + +# MemoryCaptures can get excessive in size. +# They also could contain extremely sensitive data +/[Mm]emoryCaptures/ + +# Recordings can get excessive in size +/[Rr]ecordings/ + +# Uncomment this line if you wish to ignore the asset store tools plugin +# /[Aa]ssets/AssetStoreTools* + +# Autogenerated Jetbrains Rider plugin +/[Aa]ssets/Plugins/Editor/JetBrains* + +# Visual Studio cache directory +.vs/ + +# Gradle cache directory +.gradle/ + +# Autogenerated VS/MD/Consulo solution and project files +ExportedObj/ +.consulo/ +*.csproj +*.unityproj +*.sln +*.suo +*.tmp +*.user +*.userprefs +*.pidb +*.booproj +*.svd +*.pdb +*.mdb +*.opendb +*.VC.db + +# Unity3D generated meta files +*.pidb.meta +*.pdb.meta +*.mdb.meta + +# Unity3D generated file on crash reports +sysinfo.txt + +# Builds +*.apk +*.aab +*.unitypackage +*.app + +# Crashlytics generated file +crashlytics-build.properties + +# Packed Addressables +/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin* + +# Temporary auto-generated Android Assets +/[Aa]ssets/[Ss]treamingAssets/aa.meta +/[Aa]ssets/[Ss]treamingAssets/aa/* \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index c1e71fc..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Unity Editor", - "type": "unity", - "request": "launch" - }, - { - "name": "Windows Player", - "type": "unity", - "request": "launch" - }, - { - "name": "OSX Player", - "type": "unity", - "request": "launch" - }, - { - "name": "Linux Player", - "type": "unity", - "request": "launch" - }, - { - "name": "iOS Player", - "type": "unity", - "request": "launch" - }, - { - "name": "Android Player", - "type": "unity", - "request": "launch" - } - ] -} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 4edd970..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "files.exclude": - { - "**/.DS_Store":true, - "**/.git":true, - "**/.gitignore":true, - "**/.gitmodules":true, - "**/*.booproj":true, - "**/*.pidb":true, - "**/*.suo":true, - "**/*.user":true, - "**/*.userprefs":true, - "**/*.unityproj":true, - "**/*.dll":true, - "**/*.exe":true, - "**/*.pdf":true, - "**/*.mid":true, - "**/*.midi":true, - "**/*.wav":true, - "**/*.gif":true, - "**/*.ico":true, - "**/*.jpg":true, - "**/*.jpeg":true, - "**/*.png":true, - "**/*.psd":true, - "**/*.tga":true, - "**/*.tif":true, - "**/*.tiff":true, - "**/*.3ds":true, - "**/*.3DS":true, - "**/*.fbx":true, - "**/*.FBX":true, - "**/*.lxo":true, - "**/*.LXO":true, - "**/*.ma":true, - "**/*.MA":true, - "**/*.obj":true, - "**/*.OBJ":true, - "**/*.asset":true, - "**/*.cubemap":true, - "**/*.flare":true, - "**/*.mat":true, - "**/*.meta":true, - "**/*.prefab":true, - "**/*.unity":true, - "build/":true, - "Build/":true, - "Library/":true, - "library/":true, - "obj/":true, - "Obj/":true, - "ProjectSettings/":true, - "temp/":true, - "Temp/":true - } -} \ No newline at end of file diff --git a/Assets/DeactivateLights.cs b/Assets/DeactivateLights.cs new file mode 100644 index 0000000..b832715 --- /dev/null +++ b/Assets/DeactivateLights.cs @@ -0,0 +1,30 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +[ExecuteAlways] +public class DeactivateLights : MonoBehaviour +{ + public bool deacivateLights; + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + if (deacivateLights) + { + Light[] lights = GetComponentsInChildren(); + + foreach (Light light in lights) + { + light.enabled = false; + } + deacivateLights = false; + DestroyImmediate(this); + } + } +} diff --git a/Assets/Scripts/GOBManager.cs.meta b/Assets/DeactivateLights.cs.meta similarity index 83% rename from Assets/Scripts/GOBManager.cs.meta rename to Assets/DeactivateLights.cs.meta index 531c53c..4a67a43 100644 --- a/Assets/Scripts/GOBManager.cs.meta +++ b/Assets/DeactivateLights.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: c583c298051cfe54dbcde7b3faaf5d74 +guid: a2e3e61a45554c4409855e6e5517a24d MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Editor/SithEditor.cs b/Assets/Editor/SithEditor.cs index e14a101..c03e603 100644 --- a/Assets/Editor/SithEditor.cs +++ b/Assets/Editor/SithEditor.cs @@ -1,11 +1,16 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using jksharp.jklviewer; using UnityEditor; using UnityEngine; using System.Collections; -using Assets.Scripts; +using Assets.Sith; + +using Assets.Sith.Content; +using Assets.Sith.Game; +using Assets.Sith.Game.World; +using Assets.Sith.Vfs; + public class SithEditor : EditorWindow { @@ -15,10 +20,12 @@ public static void ShowWindow() EditorWindow.GetWindow(typeof(SithEditor)); } - private string _jkPath = @"D:\Spel\Steam\steamapps\common\Star Wars Jedi Knight"; + private string _gamePath = @""; private string _assetPath = "Extracted\\"; private IEnumerable _gobFiles; private bool _gobFilesEnabled; + private IEnumerable _levelFiles; + private Vector2 _scrollPos; void Start() { @@ -26,10 +33,13 @@ void Start() void OnGUI() { - _jkPath = EditorGUILayout.TextField("Jedi Knight path", _jkPath); + _gamePath = EditorGUILayout.TextField("Game path", _gamePath); + if (!Directory.Exists(_gamePath)) return; if (GUILayout.Button("Find GOBs")) { - _gobFiles = Directory.GetFiles(_jkPath, "*.gob", SearchOption.AllDirectories).Select(x => new GobFile { Path = x.Replace(_jkPath + "\\", ""), Enabled = false }).ToArray(); + _gobFiles = Directory.EnumerateFiles(_gamePath, "*.*", SearchOption.AllDirectories) + .Where(s => s.ToLower().EndsWith(".gob") || s.ToLower().EndsWith(".goo")) + .Select(x => new GobFile { Path = x.Replace(_gamePath + "\\", ""), Enabled = false }).ToArray(); } if (_gobFiles != null) @@ -47,12 +57,69 @@ void OnGUI() { foreach (var gobFile in _gobFiles.Where(x => x.Enabled)) { - using (var stream = new GOBStream(Path.Combine(_jkPath, gobFile.Path))) + using (var stream = new GOBStream(Path.Combine(_gamePath, gobFile.Path))) { stream.Extract(Path.Combine(_assetPath, gobFile.Path)); } } } + + if (GUILayout.Button("Find levels")) + { + _levelFiles = Directory.EnumerateFiles(_gamePath, "*.*", SearchOption.AllDirectories) + .Where(s => s.ToLower().EndsWith(".jkl") || s.ToLower().EndsWith(".ndy")) + .Select(x => x.Replace(_gamePath + "\\", "")) + .ToArray(); + } + + if (_levelFiles != null) + { + GUILayout.Label("Level Files"); + EditorGUILayout.BeginHorizontal(); + _scrollPos = EditorGUILayout.BeginScrollView(_scrollPos); + foreach (var file in _levelFiles) + { + //gobFile.Enabled = EditorGUILayout.Toggle(gobFile.Path, gobFile.Enabled); + EditorGUILayout.BeginHorizontal(); + GUILayout.Label(file); + if (GUILayout.Button("Load", GUILayout.Width(100))) + { + SithAssets.Instance.AddSystemPath(_gamePath); + SithAssets.Instance.AddSystemPath(Path.Combine(_gamePath, "Resource")); + SithAssets.Instance.AddSystemPath(Path.Combine(_gamePath, "Extracted")); + + // JKDF2 + SithAssets.Instance.AddGob(Path.Combine(_gamePath, "Resource\\Res1hi.gob")); + SithAssets.Instance.AddGob(Path.Combine(_gamePath, "Resource\\Res2.gob")); + SithAssets.Instance.AddGob(Path.Combine(_gamePath, "Episode\\JK1.GOB")); + SithAssets.Instance.AddGob(Path.Combine(_gamePath, "Episode\\JK1CTF.GOB")); + SithAssets.Instance.AddGob(Path.Combine(_gamePath, "Episode\\JK1MP.GOB")); + + // MOTS + SithAssets.Instance.AddGob(Path.Combine(_gamePath, "Resource\\JKMRES.GOO")); + SithAssets.Instance.AddGob(Path.Combine(_gamePath, "Resource\\JKMsndLO.goo")); + SithAssets.Instance.AddGob(Path.Combine(_gamePath, "Episode\\JKM.GOO")); + SithAssets.Instance.AddGob(Path.Combine(_gamePath, "Episode\\JKM_KFY.GOO")); + SithAssets.Instance.AddGob(Path.Combine(_gamePath, "Episode\\JKM_MP.GOO")); + SithAssets.Instance.AddGob(Path.Combine(_gamePath, "Episode\\Jkm_saber.GOO")); + + // IJIM + SithAssets.Instance.AddGob(Path.Combine(_gamePath, "cd1.gob")); + SithAssets.Instance.AddGob(Path.Combine(_gamePath, "cd2.gob")); + SithAssets.Instance.AddGob(Path.Combine(_gamePath, "Resource\\cd1.gob")); + SithAssets.Instance.AddGob(Path.Combine(_gamePath, "Resource\\cd2.gob")); + + var go = new GameObject("SithWorld"); + var world = go.AddComponent(); + world.Load(file); + } + + EditorGUILayout.EndHorizontal(); + } + EditorGUILayout.EndScrollView(); + EditorGUILayout.EndHorizontal(); + } + } class GobFile diff --git a/Assets/ExportMaterial.cs b/Assets/ExportMaterial.cs new file mode 100644 index 0000000..e8ba543 --- /dev/null +++ b/Assets/ExportMaterial.cs @@ -0,0 +1,65 @@ +using System.Collections; +using System.Collections.Generic; +using System.Threading.Tasks; +using UnityEngine; +using UnityEditor; +using UnityEngine.UI; +using System.IO; + +public class ExportMaterial : MonoBehaviour +{ + public bool export; + //public Button m_HitMeButton; + + private void Start() + { + //Button btn = m_HitMeButton.GetComponent