Browse Source

Merge branch 'master' into console

console
Nico de Poel 5 years ago
parent
commit
83a8e13208
  1. 26
      Assets/Scripts/AudioManager.cs
  2. 6
      Assets/Scripts/QuakeParms.cs
  3. 5
      Assets/Scripts/Support/AliasModel.cs
  4. 6
      Assets/Styles/GLQuake/GLQuake.asset
  5. 9
      ProjectSettings/DynamicsManager.asset

26
Assets/Scripts/AudioManager.cs

@ -31,6 +31,13 @@ public class AudioManager : MonoBehaviour
}
}
[SerializeField, Range(0, 1)]
private float masterVolume = 1f;
private float prevMasterVolume;
private FMOD.ChannelGroup masterChannelGroup;
void Awake()
{
// Ensure FMOD is initialized the moment Instance is accessed
@ -43,6 +50,20 @@ public class AudioManager : MonoBehaviour
InitFmod();
}
void Update()
{
if (!fmodSystem.hasHandle() || !masterChannelGroup.hasHandle())
return;
if (!Mathf.Approximately(masterVolume, prevMasterVolume))
{
masterChannelGroup.setVolume(masterVolume);
prevMasterVolume = masterVolume;
}
masterChannelGroup.getVolume(out masterVolume);
}
void OnDisable()
{
// Ensure FMOD gets closed before hot reload
@ -85,6 +106,11 @@ public class AudioManager : MonoBehaviour
result = fmodSystem.init(MaxVirtualChannels, FMOD.INITFLAGS.VOL0_BECOMES_VIRTUAL, IntPtr.Zero);
CheckFmodResult(result, "FMOD.System.init");
result = fmodSystem.getMasterChannelGroup(out masterChannelGroup);
CheckFmodResult(result, "FMOD.System.getMasterChannelGroup");
masterChannelGroup.setVolume(masterVolume);
prevMasterVolume = masterVolume;
}
private void CheckFmodResult(FMOD.RESULT result, string cause)

6
Assets/Scripts/QuakeParms.cs

@ -29,7 +29,9 @@ public class QuakeParms
public IntPtr ToNativePtr()
{
if (nativeBlock == IntPtr.Zero)
nativeBlock = Marshal.AllocHGlobal(Marshal.SizeOf<QuakeParms>());
Marshal.StructureToPtr(this, nativeBlock, false);
return nativeBlock;
}
@ -48,6 +50,10 @@ public class QuakeParms
{
memSize = memorySize;
memBase = Marshal.AllocHGlobal(memorySize);
if (memBase == IntPtr.Zero)
{
throw new OutOfMemoryException($"Could not allocate {memorySize / 1024 / 1024} MB of heap memory!");
}
}
public void Destroy()

5
Assets/Scripts/Support/AliasModel.cs

@ -112,6 +112,9 @@ public class AliasModel
continue;
}
// TODO do we maybe need to distinguish between frames and poses here after all?
// In most cases frames and poses are correlated 1-to-1, but perhaps not always. This could cause subtle animation glitches.
if (frameName != animName)
{
// New animation sequence; convert the previous sequence into a blend shape animation
@ -284,7 +287,7 @@ public class AliasModel
mesh.SetUVs(0, uvs);
mesh.Optimize();
mesh.RecalculateBounds();
mesh.UploadMeshData(false);
mesh.UploadMeshData(false); // Meshes have to stay in RAM, otherwise they won't show up in standalone builds
return mesh;
}

6
Assets/Styles/GLQuake/GLQuake.asset

@ -16,9 +16,9 @@ MonoBehaviour:
worldMaterial: {fileID: 2100000, guid: fcbaf32c00bea2344bbb1419c61364b6, type: 2}
liquidMaterial: {fileID: 2100000, guid: cd59502a1689c0847a1963c60e347987, type: 2}
liquidProperties:
waterAlpha: 0.85
slimeAlpha: 0.9
lavaAlpha: 0.95
waterAlpha: 0.8
slimeAlpha: 0.85
lavaAlpha: 0.9
teleporterAlpha: 1
particles:
explosion: {fileID: 0}

9
ProjectSettings/DynamicsManager.asset

@ -3,10 +3,11 @@
--- !u!55 &1
PhysicsManager:
m_ObjectHideFlags: 0
serializedVersion: 11
m_Gravity: {x: 0, y: -9.81, z: 0}
serializedVersion: 13
m_Gravity: {x: 0, y: -800, z: 0}
m_DefaultMaterial: {fileID: 0}
m_BounceThreshold: 2
m_DefaultMaxDepenetrationVelocity: 10
m_SleepThreshold: 0.005
m_DefaultContactOffset: 0.01
m_DefaultSolverIterations: 6
@ -22,6 +23,7 @@ PhysicsManager:
m_AutoSyncTransforms: 0
m_ReuseCollisionCallbacks: 1
m_ClothInterCollisionSettingsToggle: 0
m_ClothGravity: {x: 0, y: -9.81, z: 0}
m_ContactPairsMode: 0
m_BroadphaseType: 0
m_WorldBounds:
@ -31,4 +33,5 @@ PhysicsManager:
m_FrictionType: 0
m_EnableEnhancedDeterminism: 0
m_EnableUnifiedHeightmaps: 1
m_DefaultMaxAngluarSpeed: 7
m_SolverType: 0
m_DefaultMaxAngularSpeed: 7
Loading…
Cancel
Save