more fixes
This commit is contained in:
8
Data.meta
Normal file
8
Data.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d7e9b1c3e60e2ff48be3cd61902ba6f1
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Data/SPLASHLICENSE.DAT
Normal file
BIN
Data/SPLASHLICENSE.DAT
Normal file
Binary file not shown.
7
Data/SPLASHLICENSE.DAT.meta
Normal file
7
Data/SPLASHLICENSE.DAT.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 244f6913a02805e4aa3cebdd1240cab7
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -109,6 +109,13 @@ namespace SplashEdit.EditorCode
|
||||
return Path.Combine(BuildOutputDir, $"scene_{sceneIndex}.splashpack");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Default license file path (SPLASHLICENSE.DAT) shipped in the package Data folder.
|
||||
/// Resolved relative to the Unity project so it works on any machine.
|
||||
/// </summary>
|
||||
public static string DefaultLicenseFilePath =>
|
||||
Path.GetFullPath(Path.Combine("Packages", "net.psxsplash.splashedit", "Data", "SPLASHLICENSE.DAT"));
|
||||
|
||||
/// <summary>
|
||||
/// Gets the loader pack (loading screen) output path for a scene by index.
|
||||
/// Uses a deterministic naming scheme: scene_0.loading, scene_1.loading, etc.
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace SplashEdit.EditorCode
|
||||
/// </summary>
|
||||
public static string LicenseFilePath
|
||||
{
|
||||
get => EditorPrefs.GetString(Prefix + "LicenseFilePath", "");
|
||||
get => EditorPrefs.GetString(Prefix + "LicenseFilePath", SplashBuildPaths.DefaultLicenseFilePath);
|
||||
set => EditorPrefs.SetString(Prefix + "LicenseFilePath", value);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ namespace SplashEdit.EditorCode
|
||||
private SerializedProperty _isRepeatable;
|
||||
private SerializedProperty _cooldownFrames;
|
||||
private SerializedProperty _showPrompt;
|
||||
private SerializedProperty _promptCanvasName;
|
||||
private SerializedProperty _requireLineOfSight;
|
||||
private SerializedProperty _interactionOffset;
|
||||
|
||||
private static readonly string[] ButtonNames =
|
||||
{
|
||||
@@ -34,8 +34,8 @@ namespace SplashEdit.EditorCode
|
||||
_isRepeatable = serializedObject.FindProperty("isRepeatable");
|
||||
_cooldownFrames = serializedObject.FindProperty("cooldownFrames");
|
||||
_showPrompt = serializedObject.FindProperty("showPrompt");
|
||||
_promptCanvasName = serializedObject.FindProperty("promptCanvasName");
|
||||
_requireLineOfSight = serializedObject.FindProperty("requireLineOfSight");
|
||||
_interactionOffset = serializedObject.FindProperty("interactionOffset");
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
@@ -76,15 +76,35 @@ namespace SplashEdit.EditorCode
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
|
||||
EditorGUILayout.PropertyField(_showPrompt);
|
||||
EditorGUILayout.Space(4);
|
||||
|
||||
EditorGUILayout.PropertyField(_showPrompt, new GUIContent("Show Prompt Canvas"));
|
||||
|
||||
if (_showPrompt.boolValue)
|
||||
{
|
||||
EditorGUI.indentLevel++;
|
||||
EditorGUILayout.PropertyField(_promptCanvasName, new GUIContent("Canvas Name"));
|
||||
if (string.IsNullOrEmpty(_promptCanvasName.stringValue))
|
||||
{
|
||||
EditorGUILayout.HelpBox(
|
||||
"Enter the name of a PSXCanvas that will be shown when the player is in range and hidden when they leave.",
|
||||
MessageType.Info);
|
||||
}
|
||||
if (_promptCanvasName.stringValue != null && _promptCanvasName.stringValue.Length > 15)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Canvas name is limited to 15 characters.", MessageType.Warning);
|
||||
}
|
||||
EditorGUI.indentLevel--;
|
||||
}
|
||||
});
|
||||
|
||||
EditorGUILayout.Space(2);
|
||||
|
||||
_advancedFoldout = PSXEditorStyles.DrawFoldoutCard("Advanced", _advancedFoldout, () =>
|
||||
{
|
||||
EditorGUILayout.PropertyField(_requireLineOfSight);
|
||||
EditorGUILayout.PropertyField(_interactionOffset);
|
||||
EditorGUILayout.PropertyField(_requireLineOfSight,
|
||||
new GUIContent("Require Facing",
|
||||
"Player must be facing the object to interact. Uses a forward-direction check."));
|
||||
});
|
||||
|
||||
EditorGUILayout.Space(4);
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// I raged that my scrollwheel was broken while writing this and that's why it's 2 files.
|
||||
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using SplashEdit.RuntimeCode;
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace SplashEdit.EditorCode
|
||||
if (collType == PSXCollisionType.Static)
|
||||
{
|
||||
EditorGUILayout.LabelField(
|
||||
"<color=#88cc88>Baked into world collision mesh. No runtime cost.</color>",
|
||||
"<color=#88cc88>Only bakes holes in the navregions</color>",
|
||||
PSXEditorStyles.RichLabel);
|
||||
}
|
||||
else if (collType == PSXCollisionType.Dynamic)
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace SplashEdit.RuntimeCode
|
||||
/// At export time, the AudioClip is converted to SPU ADPCM and packed
|
||||
/// into the splashpack for runtime loading.
|
||||
/// </summary>
|
||||
[AddComponentMenu("PSX/Audio Clip")]
|
||||
[AddComponentMenu("PSX/PSX Audio Clip")]
|
||||
[Icon("Packages/net.psxsplash.splashedit/Icons/PSXAudioClip.png")]
|
||||
public class PSXAudioClip : MonoBehaviour
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace SplashEdit.RuntimeCode
|
||||
[SerializeField] private float interactionRadius = 2.0f;
|
||||
|
||||
[Tooltip("Button that triggers interaction (0-15, matches PS1 button mapping)")]
|
||||
[SerializeField] private int interactButton = 5; // Default to Cross button
|
||||
[SerializeField] private int interactButton = 14; // Default to Cross button
|
||||
|
||||
[Tooltip("Can this object be interacted with multiple times?")]
|
||||
[SerializeField] private bool isRepeatable = true;
|
||||
@@ -24,39 +24,35 @@ namespace SplashEdit.RuntimeCode
|
||||
[Tooltip("Cooldown between interactions (in frames, 60 = 1 second at NTSC)")]
|
||||
[SerializeField] private ushort cooldownFrames = 30;
|
||||
|
||||
[Tooltip("Show interaction prompt when in range (requires UI system)")]
|
||||
[SerializeField] private bool showPrompt = true;
|
||||
[Tooltip("Show a UI canvas when the player is in range")]
|
||||
[SerializeField] private bool showPrompt = false;
|
||||
|
||||
[Tooltip("Name of the PSXCanvas to show when the player is in range")]
|
||||
[SerializeField] private string promptCanvasName = "";
|
||||
|
||||
[Header("Advanced")]
|
||||
[Tooltip("Require line-of-sight to player for interaction")]
|
||||
[Tooltip("Require the player to be facing this object to interact")]
|
||||
[SerializeField] private bool requireLineOfSight = false;
|
||||
|
||||
[Tooltip("Custom interaction point offset from object center")]
|
||||
[SerializeField] private Vector3 interactionOffset = Vector3.zero;
|
||||
|
||||
// Public accessors for export
|
||||
public float InteractionRadius => interactionRadius;
|
||||
public int InteractButton => interactButton;
|
||||
public bool IsRepeatable => isRepeatable;
|
||||
public ushort CooldownFrames => cooldownFrames;
|
||||
public bool ShowPrompt => showPrompt;
|
||||
public string PromptCanvasName => promptCanvasName;
|
||||
public bool RequireLineOfSight => requireLineOfSight;
|
||||
public Vector3 InteractionOffset => interactionOffset;
|
||||
|
||||
private void OnDrawGizmosSelected()
|
||||
{
|
||||
// Draw interaction radius
|
||||
Gizmos.color = new Color(1f, 1f, 0f, 0.3f); // Yellow, semi-transparent
|
||||
Vector3 center = transform.position + interactionOffset;
|
||||
Vector3 center = transform.position;
|
||||
Gizmos.DrawWireSphere(center, interactionRadius);
|
||||
|
||||
// Draw filled sphere with lower alpha
|
||||
Gizmos.color = new Color(1f, 1f, 0f, 0.1f);
|
||||
Gizmos.DrawSphere(center, interactionRadius);
|
||||
|
||||
// Draw interaction point
|
||||
Gizmos.color = Color.yellow;
|
||||
Gizmos.DrawSphere(center, 0.1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +311,6 @@ namespace SplashEdit.RuntimeCode
|
||||
atlases = _atlases,
|
||||
interactables = _interactables,
|
||||
audioClips = audioExports,
|
||||
collisionExporter = _collisionExporter,
|
||||
navRegionBuilder = _navRegionBuilder,
|
||||
roomBuilder = _roomBuilder,
|
||||
bvh = _bvh,
|
||||
|
||||
@@ -22,7 +22,6 @@ namespace SplashEdit.RuntimeCode
|
||||
public TextureAtlas[] atlases;
|
||||
public PSXInteractable[] interactables;
|
||||
public AudioClipExport[] audioClips;
|
||||
public PSXCollisionExporter collisionExporter;
|
||||
public PSXNavRegionBuilder navRegionBuilder;
|
||||
public PSXRoomBuilder roomBuilder;
|
||||
public BVH bvh;
|
||||
@@ -169,8 +168,8 @@ namespace SplashEdit.RuntimeCode
|
||||
writer.Write((ushort)scene.sceneType);
|
||||
writer.Write((ushort)triggerBoxCount); // was pad0
|
||||
|
||||
writer.Write((ushort)scene.collisionExporter.MeshCount);
|
||||
writer.Write((ushort)scene.collisionExporter.TriangleCount);
|
||||
writer.Write((ushort)0); // collisionMeshCount (removed, kept for binary compat)
|
||||
writer.Write((ushort)0); // collisionTriCount (removed, kept for binary compat)
|
||||
writer.Write((ushort)scene.navRegionBuilder.RegionCount);
|
||||
writer.Write((ushort)scene.navRegionBuilder.PortalCount);
|
||||
|
||||
@@ -342,7 +341,7 @@ namespace SplashEdit.RuntimeCode
|
||||
scene.bvh.WriteToBinary(writer, gte);
|
||||
|
||||
// ──────────────────────────────────────────────────────
|
||||
// Interactable components (24 bytes each)
|
||||
// Interactable components (28 bytes each)
|
||||
// ──────────────────────────────────────────────────────
|
||||
AlignToFourBytes(writer);
|
||||
foreach (PSXInteractable interactable in scene.interactables)
|
||||
@@ -353,11 +352,6 @@ namespace SplashEdit.RuntimeCode
|
||||
float radiusSq = interactable.InteractionRadius * interactable.InteractionRadius;
|
||||
writer.Write(PSXTrig.ConvertWorldToFixed12(radiusSq / (gte * gte)));
|
||||
|
||||
Vector3 offset = interactable.InteractionOffset;
|
||||
writer.Write(PSXTrig.ConvertWorldToFixed12(offset.x / gte));
|
||||
writer.Write(PSXTrig.ConvertWorldToFixed12(-offset.y / gte));
|
||||
writer.Write(PSXTrig.ConvertWorldToFixed12(offset.z / gte));
|
||||
|
||||
writer.Write((byte)interactable.InteractButton);
|
||||
byte flags = 0;
|
||||
if (interactable.IsRepeatable) flags |= 0x01;
|
||||
@@ -368,15 +362,14 @@ namespace SplashEdit.RuntimeCode
|
||||
|
||||
writer.Write((ushort)0); // currentCooldown (runtime)
|
||||
writer.Write((ushort)goIndex);
|
||||
}
|
||||
|
||||
// ──────────────────────────────────────────────────────
|
||||
// World collision soup (version 7+)
|
||||
// ──────────────────────────────────────────────────────
|
||||
if (scene.collisionExporter.MeshCount > 0)
|
||||
{
|
||||
AlignToFourBytes(writer);
|
||||
scene.collisionExporter.WriteToBinary(writer, gte);
|
||||
// Prompt canvas name (16 bytes, null-terminated, zero-padded)
|
||||
string canvasName = interactable.PromptCanvasName ?? "";
|
||||
byte[] nameBytes = new byte[16];
|
||||
int len = System.Math.Min(canvasName.Length, 15);
|
||||
for (int ci = 0; ci < len; ci++)
|
||||
nameBytes[ci] = (byte)canvasName[ci];
|
||||
writer.Write(nameBytes);
|
||||
}
|
||||
|
||||
// ──────────────────────────────────────────────────────
|
||||
|
||||
@@ -114,9 +114,6 @@ namespace SplashEdit.RuntimeCode
|
||||
// ---- Interactable section ----
|
||||
report.interactableBytes = (long)scene.interactables.Length * BytesPerInteractable;
|
||||
|
||||
// ---- Collision soup ----
|
||||
report.collisionBytes = EstimateCollisionSize(scene.collisionExporter);
|
||||
|
||||
// ---- Nav region data ----
|
||||
report.navRegionBytes = EstimateNavRegionSize(scene.navRegionBuilder);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user