Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 74 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,81 @@
.vs/
.vscode/
.vsconfig
Library/
obj/
Temp/
*.csproj
*.suo
*.sln
*.suo*.sln


jkedit/
Extracted/
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/*
38 changes: 0 additions & 38 deletions .vscode/launch.json

This file was deleted.

56 changes: 0 additions & 56 deletions .vscode/settings.json

This file was deleted.

30 changes: 30 additions & 0 deletions Assets/DeactivateLights.cs
Original file line number Diff line number Diff line change
@@ -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<Light>();

foreach (Light light in lights)
{
light.enabled = false;
}
deacivateLights = false;
DestroyImmediate(this);
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

79 changes: 73 additions & 6 deletions Assets/Editor/SithEditor.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand All @@ -15,21 +20,26 @@ 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<GobFile> _gobFiles;
private bool _gobFilesEnabled;
private IEnumerable<string> _levelFiles;
private Vector2 _scrollPos;

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)
Expand All @@ -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<SithWorld>();
world.Load(file);
}

EditorGUILayout.EndHorizontal();
}
EditorGUILayout.EndScrollView();
EditorGUILayout.EndHorizontal();
}

}

class GobFile
Expand Down
Loading