Browse Source

Merge branch 'master' into console

console
Nico de Poel 5 years ago
parent
commit
5710581295
  1. 1
      .gitignore
  2. 22
      Assets/Scripts/Data/QConstants.cs
  3. 19
      Assets/Scripts/Data/QExtensions.cs
  4. 42
      Assets/Scripts/Game/Entity.cs
  5. 25
      Assets/Scripts/Game/GameAssets.cs
  6. 59
      Assets/Scripts/Modules/GameModule.Interop.cs
  7. 59
      Assets/Scripts/Modules/GameModule.cs
  8. 23
      Assets/Scripts/Modules/RenderModule.Interop.cs
  9. 10
      Assets/Scripts/Modules/RenderModule.cs
  10. 39
      Assets/Scripts/Support/BrushModel.cs
  11. 143
      Assets/Scripts/Support/ParticleTrailController.cs
  12. 3
      Assets/Scripts/Support/ParticleTrailController.cs.meta
  13. 5
      Assets/Scripts/UniQuake.cs
  14. 151
      Assets/Scripts/VisualStyle.cs
  15. 3
      Assets/Shaders/Quake.shader
  16. 15
      Assets/Shaders/QuakeForwardPass.hlsl
  17. 6
      Assets/Shaders/QuakeInput.hlsl
  18. 26
      Assets/Styles/GLQuake/GLQuake.asset
  19. 26
      Assets/Styles/GLQuake/Software.asset
  20. 0
      Assets/Styles/Original.meta
  21. 41
      Assets/Styles/Original/GLQuake.asset
  22. 0
      Assets/Styles/Original/GLQuake.asset.meta
  23. 0
      Assets/Styles/Original/Materials.meta
  24. 2
      Assets/Styles/Original/Materials/Quake_Entity.mat
  25. 0
      Assets/Styles/Original/Materials/Quake_Entity.mat.meta
  26. 2
      Assets/Styles/Original/Materials/Quake_Liquid.mat
  27. 0
      Assets/Styles/Original/Materials/Quake_Liquid.mat.meta
  28. 2
      Assets/Styles/Original/Materials/Quake_World.mat
  29. 0
      Assets/Styles/Original/Materials/Quake_World.mat.meta
  30. 8
      Assets/Styles/Original/Particles.meta
  31. 10132
      Assets/Styles/Original/Particles/BlobExplosion.prefab
  32. 7
      Assets/Styles/Original/Particles/BlobExplosion.prefab.meta
  33. 4864
      Assets/Styles/Original/Particles/LavaSplash.prefab
  34. 7
      Assets/Styles/Original/Particles/LavaSplash.prefab.meta
  35. BIN
      Assets/Styles/Original/Particles/Particle.png
  36. 108
      Assets/Styles/Original/Particles/Particle.png.meta
  37. 4864
      Assets/Styles/Original/Particles/ParticleEffect.prefab
  38. 7
      Assets/Styles/Original/Particles/ParticleEffect.prefab.meta
  39. 9727
      Assets/Styles/Original/Particles/ParticleExplosion.prefab
  40. 7
      Assets/Styles/Original/Particles/ParticleExplosion.prefab.meta
  41. 4821
      Assets/Styles/Original/Particles/ParticleTrail.prefab
  42. 7
      Assets/Styles/Original/Particles/ParticleTrail.prefab.meta
  43. 4864
      Assets/Styles/Original/Particles/RogueExplosion.prefab
  44. 7
      Assets/Styles/Original/Particles/RogueExplosion.prefab.meta
  45. 143
      Assets/Styles/Original/Particles/RoundParticle.mat
  46. 8
      Assets/Styles/Original/Particles/RoundParticle.mat.meta
  47. 142
      Assets/Styles/Original/Particles/SquareParticle.mat
  48. 8
      Assets/Styles/Original/Particles/SquareParticle.mat.meta
  49. 4864
      Assets/Styles/Original/Particles/TeleportSplash.prefab
  50. 7
      Assets/Styles/Original/Particles/TeleportSplash.prefab.meta
  51. 41
      Assets/Styles/Original/Software.asset
  52. 0
      Assets/Styles/Original/Software.asset.meta
  53. 10
      Packages/manifest.json
  54. 12
      Packages/packages-lock.json
  55. 4
      ProjectSettings/ProjectSettings.asset
  56. 4
      ProjectSettings/ProjectVersion.txt
  57. 14
      engine/Quake/cl_main.c
  58. 1
      engine/Quake/client.h
  59. 2
      engine/Quake/r_alias.c
  60. 49
      engine/Quake/r_part.c
  61. 10
      engine/Quake/render.h
  62. 60
      engine/UniQuake/game_uniquake.c
  63. 26
      engine/Windows/VisualStudio/uniquake.vcxproj

1
.gitignore

@ -17,3 +17,4 @@ Debug Portable/
Assets/StreamingAssets/
Build*/
*_Debug/
Data/

22
Assets/Scripts/Data/QConstants.cs

@ -9,3 +9,25 @@
public const int LightmapBlockWidth = 256; // Should correspond to LMBLOCK_WIDTH
public const int LightmapBlockHeight = 256; // Should correspond to LMBLOCK_HEIGHT
}
// Should correspond to particle_effect_t in game_uniquake.c
public enum ParticleEffect
{
Explosion = 0,
RogueExplosion,
BlobExplosion,
LavaSplash,
TeleportSplash,
}
// Should correspond to `int type` argument in R_RocketTrail
public enum ParticleTrail
{
Rocket = 0,
Smoke = 1,
Blood = 2,
Tracer = 3,
SlightBlood = 4,
Tracer2 = 5,
VoreBall = 6,
}

19
Assets/Scripts/Data/QExtensions.cs

@ -55,6 +55,11 @@ public static class QExtensions
{
return new Vector3(origin.y, origin.z, -origin.x);
}
public static Vector3 ToUnityDirection(this QVec3 dir)
{
return new Vector3(dir.y, dir.z, -dir.x);
}
public static Quaternion ToUnityRotation(this QVec3 angles)
{
@ -62,4 +67,18 @@ public static class QExtensions
* Quaternion.AngleAxis(angles.x, Vector3.right)
* Quaternion.AngleAxis(angles.z, Vector3.forward);
}
public static Color ToColor(this uint color)
{
return new Color32(
(byte)(color & 0xFF),
(byte)((color >> 8) & 0xFF),
(byte)((color >> 16) & 0xFF),
(byte)((color >> 24) & 0xFF));
}
public static Color ToColor(this QVec3 vec)
{
return new Color(vec.x, vec.y, vec.z);
}
}

42
Assets/Scripts/Game/Entity.cs

@ -18,6 +18,8 @@ public class Entity
private AliasModel aliasModel;
private GameObject brushModel;
private GameObject worldModel;
private ParticleTrailController particleTrail;
public Entity(int entityNum, VisualStyle visualStyle, Layers layer)
{
@ -38,9 +40,10 @@ public class Entity
meshRenderer = gameObject.AddComponent<MeshRenderer>();
meshRenderer.enabled = false;
}
public void Destroy()
{
ClearParticleTrail();
Object.Destroy(gameObject);
}
@ -131,6 +134,13 @@ public class Entity
{
gameObject.transform.position = position;
gameObject.transform.rotation = rotation;
// Note: we can't parent the particle trail to the entity's game object,
// since that will instantly destroy all particles when the entity is destroyed or disabled.
if (particleTrail != null)
{
particleTrail.transform.position = position;
}
}
public void SetSkin(int skinNum)
@ -149,6 +159,15 @@ public class Entity
}
}
public void SetLighting(Vector3 shadeVector, Color lightColor)
{
if (material == null)
return;
material.SetVector("_ShadeVector", shadeVector);
material.SetVector("_LightColor", lightColor);
}
private void AssignMeshRenderer()
{
material = visualStyle.CreateEntityMaterial(true);
@ -168,4 +187,25 @@ public class Entity
SetSkin(skinNumber);
}
public bool HasParticleTrail(ParticleTrail type)
{
return particleTrail != null && particleTrail.Type == type;
}
public void SetParticleTrail(ParticleTrailController trail)
{
ClearParticleTrail();
particleTrail = trail;
}
public void ClearParticleTrail()
{
if (particleTrail != null)
{
particleTrail.Stop();
particleTrail = null;
}
}
}

25
Assets/Scripts/Game/GameAssets.cs

@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using Unity.Collections;
using UnityEngine;
public class GameAssets
@ -63,15 +64,33 @@ public class GameAssets
}
public void UploadLightmap(int lightmapNum, int width, int height, byte[] data)
{
var lightmap = GetOrCreateLightmap(lightmapNum, width, height);
lightmap.SetPixelData(data, 0);
lightmap.Apply();
}
public void UploadLightmap(int lightmapNum, int width, int height, NativeArray<byte> data)
{
var lightmap = GetOrCreateLightmap(lightmapNum, width, height);
lightmap.SetPixelData(data, 0);
lightmap.Apply();
}
private Texture2D GetOrCreateLightmap(int lightmapNum, int width, int height)
{
if (!lightmaps.TryGetValue(lightmapNum, out var lightmap))
{
lightmap = new Texture2D(width, height, TextureFormat.RGBA32, false) { name = $"Lightmap_{lightmapNum}", wrapMode = TextureWrapMode.Clamp };
lightmap = new Texture2D(width, height, TextureFormat.RGBA32, false)
{
name = $"Lightmap_{lightmapNum}",
wrapMode = TextureWrapMode.Clamp,
};
lightmaps.Add(lightmapNum, lightmap);
}
lightmap.SetPixelData(data, 0);
lightmap.Apply();
return lightmap;
}
public bool TryGetLightmap(int lightmapNum, out Texture2D lightmap)

59
Assets/Scripts/Modules/GameModule.Interop.cs

@ -17,6 +17,11 @@ public partial class GameModule : CallbackHandler<GameModule>
RemoveEntity = CreateCallback<GameRemoveEntityCallback>(Callback_GameRemoveEntity),
UpdateEntityAnimation = CreateCallback<GameUpdateEntityAnimationCallback>(Callback_GameUpdateEntityAnimation),
SetEntitySkin = CreateCallback<GameSetEntitySkinCallback>(Callback_GameSetEntitySkin),
SetEntityLighting = CreateCallback<GameSetEntityLightingCallback>(Callback_GameSetEntityLighting),
RunParticleEffect = CreateCallback<RunParticleEffectCallback>(Callback_RunParticleEffect),
CreateParticleEffect = CreateCallback<CreateParticleEffectCallback>(Callback_CreateParticleEffect),
CreateParticleTrail = CreateCallback<CreateParticleTrailCallback>(Callback_CreateParticleTrail),
};
RegisterCallbacks(callbacks);
@ -33,6 +38,11 @@ public partial class GameModule : CallbackHandler<GameModule>
public IntPtr RemoveEntity;
public IntPtr UpdateEntityAnimation;
public IntPtr SetEntitySkin;
public IntPtr SetEntityLighting;
public IntPtr RunParticleEffect;
public IntPtr CreateParticleEffect;
public IntPtr CreateParticleTrail;
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
@ -89,4 +99,53 @@ public partial class GameModule : CallbackHandler<GameModule>
GetSelf(context).SetEntitySkin(entityNum, skinNum);
Profiler.EndSample();
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate void GameSetEntityLightingCallback(IntPtr context, int entityNum, ref QVec3 shadeVector, ref QVec3 lightColor);
[MonoPInvokeCallback(typeof(GameSetEntityLightingCallback))]
private static void Callback_GameSetEntityLighting(IntPtr context, int entityNum, ref QVec3 shadeVector, ref QVec3 lightColor)
{
Profiler.BeginSample("GameSetEntityLighting");
GetSelf(context).SetEntityLighting(entityNum, shadeVector.ToUnityDirection(), lightColor.ToColor());
Profiler.EndSample();
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate void RunParticleEffectCallback(IntPtr context, ref QVec3 origin, ref QVec3 direction, uint colorMin, uint colorMax, int count);
[MonoPInvokeCallback(typeof(RunParticleEffectCallback))]
private static void Callback_RunParticleEffect(IntPtr context, ref QVec3 origin, ref QVec3 direction, uint colorMin, uint colorMax, int count)
{
Profiler.BeginSample("RunParticleEffect");
GetSelf(context).RunParticleEffect(origin.ToUnityPosition(), direction.ToUnityDirection(), colorMin.ToColor(), colorMax.ToColor(), count);
Profiler.EndSample();
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate void CreateParticleEffectCallback(IntPtr context, ParticleEffect type, ref QVec3 origin, uint colorMin, uint colorMax);
[MonoPInvokeCallback(typeof(CreateParticleEffectCallback))]
private static void Callback_CreateParticleEffect(IntPtr context, ParticleEffect type, ref QVec3 origin, uint colorMin, uint colorMax)
{
Profiler.BeginSample("CreateParticleEffect");
if (type == ParticleEffect.RogueExplosion)
GetSelf(context).CreateRogueExplosion(origin.ToUnityPosition(), colorMin.ToColor(), colorMax.ToColor());
else
GetSelf(context).CreateParticleEffect(type, origin.ToUnityPosition());
Profiler.EndSample();
}
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate void CreateParticleTrailCallback(IntPtr context, int entNum, int type, ref QVec3 origin);
[MonoPInvokeCallback(typeof(CreateParticleTrailCallback))]
private static void Callback_CreateParticleTrail(IntPtr context, int entNum, int type, ref QVec3 origin)
{
Profiler.BeginSample("CreateParticleTrail");
GetSelf(context).CreateParticleTrail(entNum, type, origin.ToUnityPosition());
Profiler.EndSample();
}
}

59
Assets/Scripts/Modules/GameModule.cs

@ -67,4 +67,63 @@ public partial class GameModule
{
uq.GameState.GetEntity(entityNum).SetSkin(skinNum);
}
private void SetEntityLighting(int entityNum, Vector3 shadeVector, Color lightColor)
{
uq.GameState.GetEntity(entityNum).SetLighting(shadeVector, lightColor);
}
private void RunParticleEffect(Vector3 position, Vector3 direction, Color colorMin, Color colorMax, int count)
{
uq.CurrentStyle.Particles.RunParticleEffect(position, direction, colorMin,colorMax, count, uq.GameLayer);
}
private void CreateParticleEffect(ParticleEffect type, Vector3 position)
{
switch (type)
{
case ParticleEffect.Explosion:
uq.CurrentStyle.Particles.CreateExplosion(position, uq.GameLayer);
break;
case ParticleEffect.BlobExplosion:
uq.CurrentStyle.Particles.CreateBlobExplosion(position, uq.GameLayer);
break;
case ParticleEffect.TeleportSplash:
uq.CurrentStyle.Particles.CreateTeleportSplash(position, uq.GameLayer);
break;
case ParticleEffect.LavaSplash:
uq.CurrentStyle.Particles.CreateLavaSplash(position, uq.GameLayer);
break;
}
}
private void CreateRogueExplosion(Vector3 position, Color colorMin, Color colorMax)
{
uq.CurrentStyle.Particles.CreateRogueExplosion(position, colorMin, colorMax, uq.GameLayer);
}
private void CreateParticleTrail(int entityNum, int type, Vector3 position)
{
int dec;
if (type < 128)
{
dec = 3;
}
else
{
dec = 1;
type -= 128;
}
var trailType = (ParticleTrail)type;
var entity = uq.GameState.GetEntity(entityNum);
if (entity.HasParticleTrail(trailType))
return;
var particleTrail = uq.CurrentStyle.Particles.CreateParticleTrail(trailType, position, dec, uq.GameLayer);
if (particleTrail == null)
return;
entity.SetParticleTrail(particleTrail);
}
}

23
Assets/Scripts/Modules/RenderModule.Interop.cs

@ -1,6 +1,8 @@
using System;
using System.Runtime.InteropServices;
using AOT;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using UnityEngine;
using UnityEngine.Profiling;
@ -138,7 +140,9 @@ public partial class RenderModule: CallbackHandler<RenderModule>
return result;
}
#if UNITY_EDITOR
private readonly byte[] lightmapBytes = new byte[QConstants.LightmapBlockWidth * QConstants.LightmapBlockHeight * 4]; // 32 bits per pixel
#endif
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate bool UploadLightmapCallback(IntPtr context, int lmap, IntPtr data);
@ -146,13 +150,26 @@ public partial class RenderModule: CallbackHandler<RenderModule>
[MonoPInvokeCallback(typeof(UploadLightmapCallback))]
private static bool Callback_UploadLightmap(IntPtr context, int lmap, IntPtr data)
{
bool result;
Profiler.BeginSample("UploadLightmap");
// TODO: this is a fairly pointless additional data copy step; we could probably make this faster by wrapping the IntPtr directly into a NativeArray
#if UNITY_EDITOR
// This is fairly pointless additional data copy step; the below NativeArray approach is faster and doesn't
// produce any garbage, but it doesn't work inside the Unity Editor for some reason.
var self = GetSelf(context);
Marshal.Copy(data, self.lightmapBytes, 0, self.lightmapBytes.Length);
bool result = self.UploadLightmap(lmap, QConstants.LightmapBlockWidth, QConstants.LightmapBlockHeight, self.lightmapBytes);
result = self.UploadLightmap(lmap, QConstants.LightmapBlockWidth, QConstants.LightmapBlockHeight, self.lightmapBytes);
#else
unsafe
{
// More efficient code path that passes the native byte buffer directly to the Texture2D's pixel data
var dataArray = NativeArrayUnsafeUtility.ConvertExistingDataToNativeArray<byte>(data.ToPointer(),
QConstants.LightmapBlockWidth * QConstants.LightmapBlockHeight * 4, Allocator.None);
result = GetSelf(context).UploadLightmap(lmap, QConstants.LightmapBlockWidth, QConstants.LightmapBlockHeight, dataArray);
}
#endif
Profiler.EndSample();
return result;
}

10
Assets/Scripts/Modules/RenderModule.cs

@ -1,4 +1,5 @@
using System.Collections.Generic;
using Unity.Collections;
using UnityEngine;
using UnityEngine.Rendering;
@ -77,6 +78,15 @@ public partial class RenderModule
return true;
}
private bool UploadLightmap(int lightmapNum, int width, int height, NativeArray<byte> data)
{
if (width == 0 || height == 0)
return false;
uq.GameAssets.UploadLightmap(lightmapNum, width, height, data);
return true;
}
private void SetupView(QVec3 origin, QVec3 angles, QLeaf viewLeaf)
{
var cam = uq.Camera;

39
Assets/Scripts/Support/BrushModel.cs

@ -66,27 +66,34 @@ public class BrushModel
private void GroupSurfaces(QNode node, QSurface[] surfaces, Dictionary<(IntPtr, int, QSurfaceFlags), List<QSurface>> surfaceGroups)
{
if (node.contents < 0) // Leaf node
return;
var nodeQueue = new Queue<QNode>();
nodeQueue.Enqueue(node);
for (int surfIdx = 0; surfIdx < node.numSurfaces; ++surfIdx)
while (nodeQueue.Count > 0)
{
var surface = surfaces[node.firstSurface + surfIdx];
node = nodeQueue.Dequeue();
if (node.contents < 0) // Leaf node
continue;
IntPtr texPtr = surface.TextureInfo.texture;
int lightNum = surface.lightmapTextureNum;
QSurfaceFlags flags = surface.flags;
var key = (texPtr, lightNum, flags);
for (int surfIdx = 0; surfIdx < node.numSurfaces; ++surfIdx)
{
var surface = surfaces[node.firstSurface + surfIdx];
if (!surfaceGroups.ContainsKey(key))
surfaceGroups[key] = new List<QSurface>();
surfaceGroups[key].Add(surface);
}
IntPtr texPtr = surface.TextureInfo.texture;
int lightNum = surface.lightmapTextureNum;
QSurfaceFlags flags = surface.flags;
var key = (texPtr, lightNum, flags);
foreach (var childNode in node.Children)
{
GroupSurfaces(childNode, surfaces, surfaceGroups);
if (!surfaceGroups.ContainsKey(key))
surfaceGroups[key] = new List<QSurface>();
surfaceGroups[key].Add(surface);
}
foreach (var childNode in node.Children)
{
nodeQueue.Enqueue(childNode);
}
}
}

143
Assets/Scripts/Support/ParticleTrailController.cs

@ -0,0 +1,143 @@
using UnityEngine;
public class ParticleTrailController : MonoBehaviour
{
[SerializeField]
private ParticleSystem effect;
[SerializeField]
private ParticleTrail type;
public ParticleTrail Type => type;
public void Initialize(ParticleSystem effect, ParticleTrail type, int interval)
{
this.effect = effect;
this.type = type;
var main = effect.main;
var shape = effect.shape;
var emission = effect.emission;
emission.rateOverDistance = 1.0f / interval;
switch (type)
{
case ParticleTrail.Rocket:
{
main.startLifetime = new ParticleSystem.MinMaxCurve(0.6f, 1.2f);
shape.scale = new Vector3(6f, 6f, 6f);
var colorOverLifetime = effect.colorOverLifetime;
colorOverLifetime.enabled = true;
colorOverLifetime.color = SetupGradients(RocketColorKeys, SmokeColorKeys);
break;
}
case ParticleTrail.Smoke:
{
main.startLifetime = new ParticleSystem.MinMaxCurve(0.2f, 0.8f);
shape.scale = new Vector3(6f, 6f, 6f);
var colorOverLifetime = effect.colorOverLifetime;
colorOverLifetime.enabled = true;
colorOverLifetime.color = SetupGradients(SmokeColorKeys, SmokeColorKeys2);
break;
}
case ParticleTrail.Blood:
{
main.gravityModifierMultiplier = 0.05f;
main.startColor = new ParticleSystem.MinMaxGradient(BloodColorMin, BloodColorMax);
shape.scale = new Vector3(6f, 6f, 6f);
break;
}
case ParticleTrail.Tracer:
case ParticleTrail.Tracer2:
{
main.startLifetime = 0.5f;
main.startColor = type == ParticleTrail.Tracer
? new ParticleSystem.MinMaxGradient(TracerColorMin, TracerColorMax)
: new ParticleSystem.MinMaxGradient(Tracer2ColorMin, Tracer2ColorMax);
var velocityOverLifetime = effect.velocityOverLifetime;
velocityOverLifetime.enabled = true;
velocityOverLifetime.space = ParticleSystemSimulationSpace.Local;
velocityOverLifetime.x = new ParticleSystem.MinMaxCurve(-30, 30);
velocityOverLifetime.y = new ParticleSystem.MinMaxCurve(0, 0);
velocityOverLifetime.z = new ParticleSystem.MinMaxCurve(30, -30);
break;
}
case ParticleTrail.SlightBlood:
{
main.gravityModifierMultiplier = 0.05f;
main.startColor = new ParticleSystem.MinMaxGradient(BloodColorMin, BloodColorMax);
shape.scale = new Vector3(6f, 6f, 6f);
emission.rateOverDistance = 1.0f / (interval + 3);
break;
}
case ParticleTrail.VoreBall:
{
main.startLifetime = 0.3f;
main.startColor = new ParticleSystem.MinMaxGradient(VoreColorMin, VoreColorMax);
shape.scale = new Vector3(16f, 16f, 16f);
break;
}
}
}
public void Stop()
{
// Allow the current particles to finish simulation, then auto-destroy the particle effect
var main = effect.main;
Destroy(gameObject, main.startLifetime.constantMax);
}
private static ParticleSystem.MinMaxGradient SetupGradients(GradientColorKey[] minKeys, GradientColorKey[] maxKeys)
{
return new ParticleSystem.MinMaxGradient
{
mode = ParticleSystemGradientMode.TwoGradients,
gradientMin = new Gradient { mode = GradientMode.Fixed, colorKeys = minKeys },
gradientMax = new Gradient { mode = GradientMode.Fixed, colorKeys = maxKeys },
};
}
// TODO: these colors ought to be initialized from the Quake palette instead of being hard-coded.
// That will allow them to work with custom palettes from total conversions.
private static readonly GradientColorKey[] RocketColorKeys =
{
new GradientColorKey(new Color32(223, 171, 39, 255), 0.167f),
new GradientColorKey(new Color32(191, 119, 47, 255), 0.333f),
new GradientColorKey(new Color32(91, 91, 91, 255), 0.5f),
new GradientColorKey(new Color32(75, 75, 75, 255), 0.667f),
new GradientColorKey(new Color32(63, 63, 63, 255), 0.833f),
new GradientColorKey(new Color32(47, 47, 47, 255), 1.0f),
};
private static readonly GradientColorKey[] SmokeColorKeys =
{
new GradientColorKey(new Color32(91, 91, 91, 255), 0.25f),
new GradientColorKey(new Color32(75, 75, 75, 255), 0.5f),
new GradientColorKey(new Color32(63, 63, 63, 255), 0.75f),
new GradientColorKey(new Color32(47, 47, 47, 255), 1.0f),
};
private static readonly GradientColorKey[] SmokeColorKeys2 =
{
new GradientColorKey(new Color32(63, 63, 63, 255), 0.5f),
new GradientColorKey(new Color32(47, 47, 47, 255), 1.0f),
};
private static readonly Color BloodColorMin = new Color32(31, 0, 0, 255);
private static readonly Color BloodColorMax = new Color32(55, 0, 0, 255);
private static readonly Color TracerColorMin = new Color32(27, 27, 0, 255);
private static readonly Color TracerColorMax = new Color32(83, 83, 11, 255);
private static readonly Color Tracer2ColorMin = new Color32(147, 31, 7, 255);
private static readonly Color Tracer2ColorMax = new Color32(239, 191, 119, 255);
private static readonly Color VoreColorMin = new Color32(95, 51, 63, 255);
private static readonly Color VoreColorMax = new Color32(59, 31, 35, 255);
}

3
Assets/Scripts/Support/ParticleTrailController.cs.meta

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 7220fa57562e4a48b6fc17e6bfc0a945
timeCreated: 1628089994

5
Assets/Scripts/UniQuake.cs

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
using UnityEngine.Profiling;
public partial class UniQuake: MonoBehaviour
{
@ -138,6 +139,8 @@ public partial class UniQuake: MonoBehaviour
logHandler = CollectLog; // Collect and dump logs to Unity once per frame
Profiler.BeginSample("QuakeEngineUpdate");
try
{
UniQuake_Update(Time.deltaTime);
@ -157,6 +160,8 @@ public partial class UniQuake: MonoBehaviour
Shutdown();
}
Profiler.EndSample();
FlushLog();
}

151
Assets/Scripts/VisualStyle.cs

@ -30,6 +30,8 @@ public class VisualStyle : ScriptableObject
public virtual void Activate()
{
particles.Init();
if (pointSampling)
Shader.EnableKeyword("_POINT_SAMPLING");
else
@ -152,12 +154,155 @@ public class LiquidProperties
[System.Serializable]
public class ParticleSystems
{
[SerializeField]
protected Material particleMaterial;
[SerializeField]
protected float particleSize = 1.0f;
[SerializeField]
protected ParticleSystem particleEffect;
[SerializeField]
protected ParticleSystem explosion;
public virtual void CreateExplosion(Vector3 position)
[SerializeField]
protected ParticleSystem rogueExplosion;
[SerializeField]
protected ParticleSystem blobExplosion;
[SerializeField]
protected ParticleSystem teleportSplash;
[SerializeField]
protected ParticleSystem lavaSplash;
[SerializeField]
protected ParticleSystem particleTrail;
public virtual void Init()
{
var go = Object.Instantiate(explosion.gameObject);
go.transform.position = position;
InitTemplate(particleEffect);
InitTemplate(explosion);
InitTemplate(rogueExplosion);
InitTemplate(blobExplosion);
InitTemplate(teleportSplash);
InitTemplate(lavaSplash);
InitTemplate(particleTrail);
}
protected virtual void InitTemplate(ParticleSystem template)
{
if (template == null)
return;
var main = template.main;
main.startSize = particleSize;
if (particleMaterial != null)
{
var renderer = template.GetComponent<ParticleSystemRenderer>();
renderer.sharedMaterial = particleMaterial;
}
int childCount = template.transform.childCount;
for (int i = 0; i < childCount; ++i)
{
var child = template.transform.GetChild(i);
InitTemplate(child.GetComponent<ParticleSystem>());
}
}
public virtual void RunParticleEffect(Vector3 position, Vector3 direction, Color colorMin, Color colorMax, int count, Layers layer)
{
var effect = InstantiateEffect(particleEffect, position, layer);
if (effect == null)
return;
var main = effect.main;
main.maxParticles = count;
SetColorGradient(main, colorMin, colorMax);
var velocity = effect.velocityOverLifetime;
velocity.x = direction.x * 15f;
velocity.y = direction.y * 15f;
velocity.z = direction.z * 15f;
}
public virtual void CreateExplosion(Vector3 position, Layers layer)
{
InstantiateEffect(explosion, position, layer);
}
public virtual void CreateRogueExplosion(Vector3 position, Color colorMin, Color colorMax, Layers layer)
{
var effect = InstantiateEffect(rogueExplosion, position, layer);
if (effect == null)
return;
SetColorGradient(effect.main, colorMin, colorMax);
}
public virtual void CreateBlobExplosion(Vector3 position, Layers layer)
{
InstantiateEffect(blobExplosion, position, layer);
}
public virtual void CreateTeleportSplash(Vector3 position, Layers layer)
{
InstantiateEffect(teleportSplash, position, layer);
}
public virtual void CreateLavaSplash(Vector3 position, Layers layer)
{
InstantiateEffect(lavaSplash, position, layer);
}
public virtual ParticleTrailController CreateParticleTrail(ParticleTrail type, Vector3 position, int interval, Layers layer)
{
var effect = InstantiateEffect(particleTrail, position, layer);
if (effect == null)
return null;
var controller = effect.gameObject.GetComponent<ParticleTrailController>();
if (controller == null)
return null;
controller.Initialize(effect, type, interval);
return controller;
}
protected virtual ParticleSystem InstantiateEffect(ParticleSystem template, Vector3 position, Layers layer)
{
if (template == null)
return null;
var effect = Object.Instantiate(template);
SetLayer(effect.gameObject, layer);
effect.transform.position = position;
return effect;
}
protected static void SetLayer(GameObject go, Layers layer)
{
go.layer = (int)layer;
int childCount = go.transform.childCount;
for (int i = 0; i < childCount; ++i)
{
go.transform.GetChild(i).gameObject.layer = (int)layer;
}
}
protected static void SetColorGradient(ParticleSystem.MainModule main, Color colorMin, Color colorMax)
{
var startColor = main.startColor;
startColor.gradient.colorKeys = new[]
{
new GradientColorKey(colorMin, 0f),
new GradientColorKey(colorMax, 1f),
};
main.startColor = startColor;
}
}

3
Assets/Shaders/Quake.shader

@ -12,6 +12,9 @@ Shader "UniQuake/Quake"
[HDR] _EmissionColor("Emission Color", Color) = (0,0,0)
[NoScaleOffset]_EmissionMap("Emission Map", 2D) = "white" {}
[HideInInspector] _ShadeVector("Shade Vector", Vector) = (0, 0, 0)
[HideInInspector] _LightColor("Light Color", Color) = (1, 1, 1, 1)
// Blending state
[HideInInspector] _Surface("__surface", Float) = 0.0

15
Assets/Shaders/QuakeForwardPass.hlsl

@ -30,7 +30,7 @@ struct Varyings
float3 posWS : TEXCOORD2; // xyz: posWS
float3 normal : TEXCOORD3;
float3 normal : TEXCOORD3;
float3 viewDir : TEXCOORD4;
half4 fogFactorAndVertexLight : TEXCOORD6; // x: fogFactor, yzw: vertex light
@ -129,11 +129,14 @@ half4 LitPassFragmentSimple(Varyings input) : SV_Target
half4 lightmapColor = SAMPLE_TEXTURE2D(_LightMap, sampler_LightMap, input.lightmapUV);
half3 finalColor = diffuse * lightmapColor.rgb * 2.0f;
#else
// Specular and smoothness are some bogus values just to make models not appear completely black on one side
half3 finalColor = UniversalFragmentBlinnPhong(inputData, diffuse, half4(0.2, 0.2, 0.2, 1), 0.5, 0.0, alpha).rgb;
// Light light = GetMainLight();
// half3 diffuseColor = LightingLambert(light.color, light.direction, inputData.normalWS);
// half3 finalColor = diffuse * diffuseColor;
// This reproduces anorm_dots within a reasonable degree of tolerance
half shade = dot(_ShadeVector.xyz, inputData.normalWS);
if (shade < 0.0)
shade = 1.0 + shade * (13.0 / 44.0);
else
shade = 1.0 + shade;
half3 finalColor = diffuse * shade * _LightColor.rgb;
#endif
#ifdef _EMISSION

6
Assets/Shaders/QuakeInput.hlsl

@ -11,6 +11,8 @@ CBUFFER_START(UnityPerMaterial)
half4 _EmissionColor;
half _Cutoff;
half _Surface;
half4 _ShadeVector;
half4 _LightColor;
CBUFFER_END
#ifdef UNITY_DOTS_INSTANCING_ENABLED
@ -19,12 +21,16 @@ CBUFFER_END
UNITY_DOTS_INSTANCED_PROP(float4, _EmissionColor)
UNITY_DOTS_INSTANCED_PROP(float , _Cutoff)
UNITY_DOTS_INSTANCED_PROP(float , _Surface)
UNITY_DOTS_INSTANCED_PROP(half4, _ShadeVector)
UNITY_DOTS_INSTANCED_PROP(half4, _LightColor)
UNITY_DOTS_INSTANCING_END(MaterialPropertyMetadata)
#define _BaseColor UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO(float4 , Metadata__BaseColor)
#define _EmissionColor UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO(float4 , Metadata__EmissionColor)
#define _Cutoff UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO(float , Metadata__Cutoff)
#define _Surface UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO(float , Metadata__Surface)
#define _ShadeVector UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO(half4 , Metadata__ShadeVector)
#define _LightColor UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO(half4 , Metadata__LightColor)
#endif
SAMPLER(point_repeat_sampler);

26
Assets/Styles/GLQuake/GLQuake.asset

@ -1,26 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2df0cbad06a6ed5489201e395f9c5bb3, type: 3}
m_Name: GLQuake
m_EditorClassIdentifier:
entityMaterial: {fileID: 2100000, guid: 4d7703ac1adf3534f89b4041b779ff5e, type: 2}
worldMaterial: {fileID: 2100000, guid: fcbaf32c00bea2344bbb1419c61364b6, type: 2}
liquidMaterial: {fileID: 2100000, guid: cd59502a1689c0847a1963c60e347987, type: 2}
pointSampling: 0
affineTexturing: 0
liquidProperties:
waterAlpha: 0.8
slimeAlpha: 0.85
lavaAlpha: 0.9
teleAlpha: 1
particles:
explosion: {fileID: 0}

26
Assets/Styles/GLQuake/Software.asset

@ -1,26 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2df0cbad06a6ed5489201e395f9c5bb3, type: 3}
m_Name: Software
m_EditorClassIdentifier:
entityMaterial: {fileID: 2100000, guid: 4d7703ac1adf3534f89b4041b779ff5e, type: 2}
worldMaterial: {fileID: 2100000, guid: fcbaf32c00bea2344bbb1419c61364b6, type: 2}
liquidMaterial: {fileID: 2100000, guid: cd59502a1689c0847a1963c60e347987, type: 2}
pointSampling: 1
affineTexturing: 1
liquidProperties:
waterAlpha: 1
slimeAlpha: 1
lavaAlpha: 1
teleAlpha: 1
particles:
explosion: {fileID: 0}

0
Assets/Styles/GLQuake.meta → Assets/Styles/Original.meta

41
Assets/Styles/Original/GLQuake.asset

@ -0,0 +1,41 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2df0cbad06a6ed5489201e395f9c5bb3, type: 3}
m_Name: GLQuake
m_EditorClassIdentifier:
entityMaterial: {fileID: 2100000, guid: 4d7703ac1adf3534f89b4041b779ff5e, type: 2}
worldMaterial: {fileID: 2100000, guid: fcbaf32c00bea2344bbb1419c61364b6, type: 2}
liquidMaterial: {fileID: 2100000, guid: cd59502a1689c0847a1963c60e347987, type: 2}
pointSampling: 0
affineTexturing: 0
liquidProperties:
waterAlpha: 0.8
slimeAlpha: 0.85
lavaAlpha: 0.9
teleAlpha: 1
particles:
particleMaterial: {fileID: 2100000, guid: 4224080a2fee880419642256cbfaee41, type: 2}
particleSize: 1.38
particleEffect: {fileID: 9150008102338277659, guid: d911d6d226122ae4e97a2fc6f268503d,
type: 3}
explosion: {fileID: 9150008102338277659, guid: 94e2cf23692eef24d9a5145b0f705c55,
type: 3}
rogueExplosion: {fileID: 9150008102338277659, guid: 0a1fede38a8884d488bcf7625cad527e,
type: 3}
blobExplosion: {fileID: 9150008102338277659, guid: 3bc17ebf070910f4592c9491152e94b4,
type: 3}
teleportSplash: {fileID: 9150008102338277659, guid: 79bef89ba1457cb42a9fbeaf4acff66f,
type: 3}
lavaSplash: {fileID: 9150008102338277659, guid: 4db0c926dce46fe4c90920ecd8c5df2e,
type: 3}
particleTrail: {fileID: 9150008102338277659, guid: 6f6d855fe9d5e524b9293af4fd7caf21,
type: 3}

0
Assets/Styles/GLQuake/GLQuake.asset.meta → Assets/Styles/Original/GLQuake.asset.meta

0
Assets/Styles/GLQuake/Materials.meta → Assets/Styles/Original/Materials.meta

2
Assets/Styles/GLQuake/Materials/GLQuake_Entity.mat → Assets/Styles/Original/Materials/Quake_Entity.mat

@ -7,7 +7,7 @@ Material:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: GLQuake_Entity
m_Name: Quake_Entity
m_Shader: {fileID: 4800000, guid: eb7abeca30cd4fb4cb8be05eca69f850, type: 3}
m_ShaderKeywords: _EMISSION _RECEIVE_SHADOWS_OFF
m_LightmapFlags: 2

0
Assets/Styles/GLQuake/Materials/GLQuake_Entity.mat.meta → Assets/Styles/Original/Materials/Quake_Entity.mat.meta

2
Assets/Styles/GLQuake/Materials/GLQuake_Liquid.mat → Assets/Styles/Original/Materials/Quake_Liquid.mat

@ -20,7 +20,7 @@ Material:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: GLQuake_Liquid
m_Name: Quake_Liquid
m_Shader: {fileID: 4800000, guid: 8d2bb70cbf9db8d4da26e15b26e74248, type: 3}
m_ShaderKeywords: _EMISSION _RECEIVE_SHADOWS_OFF
m_LightmapFlags: 2

0
Assets/Styles/GLQuake/Materials/GLQuake_Liquid.mat.meta → Assets/Styles/Original/Materials/Quake_Liquid.mat.meta

2
Assets/Styles/GLQuake/Materials/GLQuake_World.mat → Assets/Styles/Original/Materials/Quake_World.mat

@ -20,7 +20,7 @@ Material:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: GLQuake_World
m_Name: Quake_World
m_Shader: {fileID: 4800000, guid: eb7abeca30cd4fb4cb8be05eca69f850, type: 3}
m_ShaderKeywords: _EMISSION _RECEIVE_SHADOWS_OFF
m_LightmapFlags: 2

0
Assets/Styles/GLQuake/Materials/GLQuake_World.mat.meta → Assets/Styles/Original/Materials/Quake_World.mat.meta

8
Assets/Styles/Original/Particles.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 03879249cd303704eba9c93d55108ba0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

10132
Assets/Styles/Original/Particles/BlobExplosion.prefab
File diff suppressed because it is too large
View File

7
Assets/Styles/Original/Particles/BlobExplosion.prefab.meta

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3bc17ebf070910f4592c9491152e94b4
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

4864
Assets/Styles/Original/Particles/LavaSplash.prefab
File diff suppressed because it is too large
View File

7
Assets/Styles/Original/Particles/LavaSplash.prefab.meta

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4db0c926dce46fe4c90920ecd8c5df2e
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/Styles/Original/Particles/Particle.png

After

Width: 64  |  Height: 64  |  Size: 1.2 KiB

108
Assets/Styles/Original/Particles/Particle.png.meta

@ -0,0 +1,108 @@
fileFormatVersion: 2
guid: 36f6501e4b60c3d4bab2eb2659039dc4
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

4864
Assets/Styles/Original/Particles/ParticleEffect.prefab
File diff suppressed because it is too large
View File

7
Assets/Styles/Original/Particles/ParticleEffect.prefab.meta

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d911d6d226122ae4e97a2fc6f268503d
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

9727
Assets/Styles/Original/Particles/ParticleExplosion.prefab
File diff suppressed because it is too large
View File

7
Assets/Styles/Original/Particles/ParticleExplosion.prefab.meta

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 94e2cf23692eef24d9a5145b0f705c55
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

4821
Assets/Styles/Original/Particles/ParticleTrail.prefab
File diff suppressed because it is too large
View File

7
Assets/Styles/Original/Particles/ParticleTrail.prefab.meta

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6f6d855fe9d5e524b9293af4fd7caf21
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

4864
Assets/Styles/Original/Particles/RogueExplosion.prefab
File diff suppressed because it is too large
View File

7
Assets/Styles/Original/Particles/RogueExplosion.prefab.meta

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0a1fede38a8884d488bcf7625cad527e
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

143
Assets/Styles/Original/Particles/RoundParticle.mat

@ -0,0 +1,143 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-826508141333875548
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 4
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: RoundParticle
m_Shader: {fileID: 4800000, guid: 0406db5a14f94604a8c57ccfbc9f3b46, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3001
stringTagMap:
RenderType: Transparent
disabledShaderPasses:
- SHADOWCASTER
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 2800000, guid: 36f6501e4b60c3d4bab2eb2659039dc4, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _AlphaClip: 0
- _Blend: 0
- _BlendOp: 0
- _BumpScale: 1
- _CameraFadingEnabled: 0
- _CameraFarFadeDistance: 2
- _CameraNearFadeDistance: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _ColorMode: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DistortionBlend: 0.5
- _DistortionEnabled: 0
- _DistortionStrength: 1
- _DistortionStrengthScaled: 0.1
- _DstBlend: 10
- _EnvironmentReflections: 1
- _FlipbookBlending: 0
- _FlipbookMode: 0
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 1
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SoftParticlesEnabled: 0
- _SoftParticlesFarFadeDistance: 1
- _SoftParticlesNearFadeDistance: 0
- _SpecularHighlights: 1
- _SrcBlend: 5
- _Surface: 1
- _WorkflowMode: 1
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _BaseColorAddSubDiff: {r: 1, g: 0, b: 0, a: 0}
- _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []

8
Assets/Styles/Original/Particles/RoundParticle.mat.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4224080a2fee880419642256cbfaee41
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

142
Assets/Styles/Original/Particles/SquareParticle.mat

@ -0,0 +1,142 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-826508141333875548
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 4
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: SquareParticle
m_Shader: {fileID: 4800000, guid: 0406db5a14f94604a8c57ccfbc9f3b46, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 2001
stringTagMap:
RenderType: Opaque
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 2800000, guid: 36f6501e4b60c3d4bab2eb2659039dc4, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _AlphaClip: 0
- _Blend: 0
- _BlendOp: 0
- _BumpScale: 1
- _CameraFadingEnabled: 0
- _CameraFarFadeDistance: 2
- _CameraNearFadeDistance: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _ColorMode: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DistortionBlend: 0.5
- _DistortionEnabled: 0
- _DistortionStrength: 1
- _DistortionStrengthScaled: 0.1
- _DstBlend: 0
- _EnvironmentReflections: 1
- _FlipbookBlending: 0
- _FlipbookMode: 0
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 1
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SoftParticlesEnabled: 0
- _SoftParticlesFarFadeDistance: 1
- _SoftParticlesNearFadeDistance: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _BaseColorAddSubDiff: {r: 1, g: 0, b: 0, a: 0}
- _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []

8
Assets/Styles/Original/Particles/SquareParticle.mat.meta

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 63b15323c45f06d4995fa1512a83cbcd
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

4864
Assets/Styles/Original/Particles/TeleportSplash.prefab
File diff suppressed because it is too large
View File

7
Assets/Styles/Original/Particles/TeleportSplash.prefab.meta

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 79bef89ba1457cb42a9fbeaf4acff66f
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

41
Assets/Styles/Original/Software.asset

@ -0,0 +1,41 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2df0cbad06a6ed5489201e395f9c5bb3, type: 3}
m_Name: Software
m_EditorClassIdentifier:
entityMaterial: {fileID: 2100000, guid: 4d7703ac1adf3534f89b4041b779ff5e, type: 2}
worldMaterial: {fileID: 2100000, guid: fcbaf32c00bea2344bbb1419c61364b6, type: 2}
liquidMaterial: {fileID: 2100000, guid: cd59502a1689c0847a1963c60e347987, type: 2}
pointSampling: 1
affineTexturing: 1
liquidProperties:
waterAlpha: 1
slimeAlpha: 1
lavaAlpha: 1
teleAlpha: 1
particles:
particleMaterial: {fileID: 2100000, guid: 63b15323c45f06d4995fa1512a83cbcd, type: 2}
particleSize: 1.08
particleEffect: {fileID: 9150008102338277659, guid: d911d6d226122ae4e97a2fc6f268503d,
type: 3}
explosion: {fileID: 9150008102338277659, guid: 94e2cf23692eef24d9a5145b0f705c55,
type: 3}
rogueExplosion: {fileID: 9150008102338277659, guid: 0a1fede38a8884d488bcf7625cad527e,
type: 3}
blobExplosion: {fileID: 9150008102338277659, guid: 3bc17ebf070910f4592c9491152e94b4,
type: 3}
teleportSplash: {fileID: 9150008102338277659, guid: 79bef89ba1457cb42a9fbeaf4acff66f,
type: 3}
lavaSplash: {fileID: 9150008102338277659, guid: 4db0c926dce46fe4c90920ecd8c5df2e,
type: 3}
particleTrail: {fileID: 9150008102338277659, guid: 6f6d855fe9d5e524b9293af4fd7caf21,
type: 3}

0
Assets/Styles/GLQuake/Software.asset.meta → Assets/Styles/Original/Software.asset.meta

10
Packages/manifest.json

@ -1,8 +1,8 @@
{
"dependencies": {
"com.unity.collab-proxy": "1.5.7",
"com.unity.ide.rider": "2.0.7",
"com.unity.ide.visualstudio": "2.0.9",
"com.unity.collab-proxy": "1.7.1",
"com.unity.ide.rider": "3.0.7",
"com.unity.ide.visualstudio": "2.0.11",
"com.unity.ide.vscode": "1.2.3",
"com.unity.inputsystem": "1.0.2",
"com.unity.render-pipelines.gamecore": "file:gamecore/com.unity.render-pipelines.gamecore-1.2.0.tgz",
@ -11,8 +11,8 @@
"com.unity.render-pipelines.universal": "10.5.1",
"com.unity.test-framework": "1.1.27",
"com.unity.textmeshpro": "3.0.6",
"com.unity.timeline": "1.4.8",
"com.unity.toolchain.win-x86_64-linux-x86_64": "0.1.19-preview",
"com.unity.timeline": "1.6.1",
"com.unity.toolchain.win-x86_64-linux-x86_64": "0.1.21-preview",
"com.unity.ugui": "1.0.0",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",

12
Packages/packages-lock.json

@ -1,7 +1,7 @@
{
"dependencies": {
"com.unity.collab-proxy": {
"version": "1.5.7",
"version": "1.7.1",
"depth": 0,
"source": "registry",
"dependencies": {
@ -17,16 +17,16 @@
"url": "https://packages.unity.com"
},
"com.unity.ide.rider": {
"version": "2.0.7",
"version": "3.0.7",
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.test-framework": "1.1.1"
"com.unity.ext.nunit": "1.0.6"
},
"url": "https://packages.unity.com"
},
"com.unity.ide.visualstudio": {
"version": "2.0.9",
"version": "2.0.11",
"depth": 0,
"source": "registry",
"dependencies": {
@ -154,7 +154,7 @@
"url": "https://packages.unity.com"
},
"com.unity.timeline": {
"version": "1.4.8",
"version": "1.6.1",
"depth": 0,
"source": "registry",
"dependencies": {
@ -166,7 +166,7 @@
"url": "https://packages.unity.com"
},
"com.unity.toolchain.win-x86_64-linux-x86_64": {
"version": "0.1.19-preview",
"version": "0.1.21-preview",
"depth": 0,
"source": "registry",
"dependencies": {

4
ProjectSettings/ProjectSettings.asset

@ -158,7 +158,7 @@ PlayerSettings:
Standalone: 0
iPhone: 0
tvOS: 0
overrideDefaultApplicationIdentifier: 0
overrideDefaultApplicationIdentifier: 1
AndroidBundleVersionCode: 1
AndroidMinSdkVersion: 19
AndroidTargetSdkVersion: 0
@ -620,7 +620,7 @@ PlayerSettings:
managedStrippingLevel: {}
incrementalIl2cppBuild: {}
suppressCommonWarnings: 1
allowUnsafeCode: 0
allowUnsafeCode: 1
useDeterministicCompilation: 1
useReferenceAssemblies: 1
enableRoslynAnalyzers: 1

4
ProjectSettings/ProjectVersion.txt

@ -1,2 +1,2 @@
m_EditorVersion: 2020.3.14f1
m_EditorVersionWithRevision: 2020.3.14f1 (d0d1bb862f9d)
m_EditorVersion: 2020.3.15f2
m_EditorVersionWithRevision: 2020.3.15f2 (6cf78cb77498)

14
engine/Quake/cl_main.c

@ -557,25 +557,25 @@ void CL_RelinkEntities (void)
}
if (ent->model->flags & EF_GIB)
R_RocketTrail (oldorg, ent->origin, 2);
R_RocketTrail (ent->num, oldorg, ent->origin, 2);
else if (ent->model->flags & EF_ZOMGIB)
R_RocketTrail (oldorg, ent->origin, 4);
R_RocketTrail (ent->num, oldorg, ent->origin, 4);
else if (ent->model->flags & EF_TRACER)
R_RocketTrail (oldorg, ent->origin, 3);
R_RocketTrail (ent->num, oldorg, ent->origin, 3);
else if (ent->model->flags & EF_TRACER2)
R_RocketTrail (oldorg, ent->origin, 5);
R_RocketTrail (ent->num, oldorg, ent->origin, 5);
else if (ent->model->flags & EF_ROCKET)
{
R_RocketTrail (oldorg, ent->origin, 0);
R_RocketTrail (ent->num, oldorg, ent->origin, 0);
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->radius = 200;
dl->die = cl.time + 0.01;
}
else if (ent->model->flags & EF_GRENADE)
R_RocketTrail (oldorg, ent->origin, 1);
R_RocketTrail (ent->num, oldorg, ent->origin, 1);
else if (ent->model->flags & EF_TRACER3)
R_RocketTrail (oldorg, ent->origin, 6);
R_RocketTrail (ent->num, oldorg, ent->origin, 6);
ent->forcelink = false;

1
engine/Quake/client.h

@ -377,6 +377,7 @@ void UQ_Game_SetEntityTransform(int entityNum, vec3_t origin, vec3_t angles);
void UQ_Game_RemoveEntity(int entityNum);
void UQ_Game_UpdateEntityAnimation(int entityNum, int pose1, int pose2, float blend);
void UQ_Game_SetEntitySkin(int entityNum, int skinNum);
void UQ_Game_SetEntityLighting(int entityNum, vec3_t shadeVector, vec3_t lightColor);
#endif /* _CLIENT_H_ */

2
engine/Quake/r_alias.c

@ -619,6 +619,8 @@ void R_SetupAliasLighting (entity_t *e)
shadedots = r_avertexnormal_dots[quantizedangle];
VectorScale (lightcolor, 1.0f / 200.0f, lightcolor);
UQ_Game_SetEntityLighting(e->num, shadevector, lightcolor);
}
/*

49
engine/Quake/r_part.c

@ -44,6 +44,7 @@ float texturescalefactor; //johnfitz -- compensate for apparent size of differen
cvar_t r_particles = {"r_particles","1", CVAR_ARCHIVE}; //johnfitz
cvar_t r_quadparticles = {"r_quadparticles","1", CVAR_ARCHIVE}; //johnfitz
#ifdef USE_OPENGL
/*
===============
R_ParticleTextureLookup -- johnfitz -- generate nice antialiased 32x32 circle for particles
@ -140,6 +141,7 @@ static void R_SetParticleTexture_f (cvar_t *var)
// break;
}
}
#endif // USE_OPENGL
/*
===============
@ -148,6 +150,7 @@ R_InitParticles
*/
void R_InitParticles (void)
{
#ifdef USE_OPENGL
int i;
i = COM_CheckParm ("-particles");
@ -171,6 +174,7 @@ void R_InitParticles (void)
Cvar_RegisterVariable (&r_quadparticles); //johnfitz
R_InitParticleTextures (); //johnfitz
#endif
}
/*
@ -188,6 +192,7 @@ float timescale = 0.01;
void R_EntityParticles (entity_t *ent)
{
#ifdef USE_OPENGL
int i;
particle_t *p;
float angle;
@ -241,6 +246,7 @@ void R_EntityParticles (entity_t *ent)
p->org[1] = ent->origin[1] + r_avertexnormals[i][1]*dist + forward[1]*beamlength;
p->org[2] = ent->origin[2] + r_avertexnormals[i][2]*dist + forward[2]*beamlength;
}
#endif
}
/*
@ -250,6 +256,7 @@ R_ClearParticles
*/
void R_ClearParticles (void)
{
#ifdef USE_OPENGL
int i;
free_particles = &particles[0];
@ -258,6 +265,7 @@ void R_ClearParticles (void)
for (i=0 ;i<r_numparticles ; i++)
particles[i].next = &particles[i+1];
particles[r_numparticles-1].next = NULL;
#endif
}
/*
@ -267,6 +275,7 @@ R_ReadPointFile_f
*/
void R_ReadPointFile_f (void)
{
#ifdef USE_OPENGL
FILE *f;
vec3_t org;
int r;
@ -315,6 +324,7 @@ void R_ReadPointFile_f (void)
fclose (f);
Con_Printf ("%i points read\n", c);
#endif
}
/*
@ -351,6 +361,9 @@ R_ParticleExplosion
*/
void R_ParticleExplosion (vec3_t org)
{
UQ_Game_ParticleExplosion(org);
#ifdef USE_OPENGL
int i, j;
particle_t *p;
@ -385,6 +398,7 @@ void R_ParticleExplosion (vec3_t org)
}
}
}
#endif
}
/*
@ -394,6 +408,9 @@ R_ParticleExplosion2
*/
void R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength)
{
UQ_Game_ParticleExplosion2(org, colorStart, colorLength);
#ifdef USE_OPENGL
int i, j;
particle_t *p;
int colorMod = 0;
@ -418,6 +435,7 @@ void R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength)
p->vel[j] = (rand()%512)-256;
}
}
#endif
}
/*
@ -427,6 +445,9 @@ R_BlobExplosion
*/
void R_BlobExplosion (vec3_t org)
{
UQ_Game_BlobExplosion(org);
#ifdef USE_OPENGL
int i, j;
particle_t *p;
@ -462,6 +483,7 @@ void R_BlobExplosion (vec3_t org)
}
}
}
#endif
}
/*
@ -471,6 +493,12 @@ R_RunParticleEffect
*/
void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count)
{
if (count == 1024)
UQ_Game_ParticleExplosion(org);
else
UQ_Game_RunParticleEffect(org, dir, color, count);
#ifdef USE_OPENGL
int i, j;
particle_t *p;
@ -519,6 +547,7 @@ void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count)
}
}
}
#endif
}
/*
@ -528,6 +557,9 @@ R_LavaSplash
*/
void R_LavaSplash (vec3_t org)
{
UQ_Game_LavaSplash(org);
#ifdef USE_OPENGL
int i, j, k;
particle_t *p;
float vel;
@ -560,6 +592,7 @@ void R_LavaSplash (vec3_t org)
vel = 50 + (rand()&63);
VectorScale (dir, vel, p->vel);
}
#endif
}
/*
@ -569,6 +602,9 @@ R_TeleportSplash
*/
void R_TeleportSplash (vec3_t org)
{
UQ_Game_TeleportSplash(org);
#ifdef USE_OPENGL
int i, j, k;
particle_t *p;
float vel;
@ -601,6 +637,7 @@ void R_TeleportSplash (vec3_t org)
vel = 50 + (rand()&63);
VectorScale (dir, vel, p->vel);
}
#endif
}
/*
@ -610,8 +647,11 @@ R_RocketTrail
FIXME -- rename function and use #defined types instead of numbers
===============
*/
void R_RocketTrail (vec3_t start, vec3_t end, int type)
void R_RocketTrail (int entnum, vec3_t start, vec3_t end, int type)
{
UQ_Game_ParticleTrail(entnum, type, start);
#ifdef USE_OPENGL
vec3_t vec;
float len;
int j;
@ -711,6 +751,7 @@ void R_RocketTrail (vec3_t start, vec3_t end, int type)
VectorAdd (start, vec, start);
}
#endif
}
/*
@ -720,6 +761,7 @@ CL_RunParticles -- johnfitz -- all the particle behavior, separated from R_DrawP
*/
void CL_RunParticles (void)
{
#ifdef USE_OPENGL
particle_t *p, *kill;
int i;
float time1, time2, time3, dvel, frametime, grav;
@ -817,6 +859,7 @@ void CL_RunParticles (void)
break;
}
}
#endif
}
/*
@ -826,6 +869,7 @@ R_DrawParticles -- johnfitz -- moved all non-drawing code to CL_RunParticles
*/
void R_DrawParticles (void)
{
#ifdef USE_OPENGL
particle_t *p;
float scale;
vec3_t up, right, p_up, p_right, p_upright; //johnfitz -- p_ vectors
@ -941,6 +985,7 @@ void R_DrawParticles (void)
glDisable (GL_BLEND);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glColor3f(1,1,1);
#endif
}
@ -951,6 +996,7 @@ R_DrawParticles_ShowTris -- johnfitz
*/
void R_DrawParticles_ShowTris (void)
{
#ifdef USE_OPENGL
particle_t *p;
float scale;
vec3_t up, right, p_up, p_right, p_upright;
@ -1021,5 +1067,6 @@ void R_DrawParticles_ShowTris (void)
}
glEnd ();
}
#endif
}

10
engine/Quake/render.h

@ -152,7 +152,7 @@ void R_NewMap (void);
void R_ParseParticleEffect (void);
void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count);
void R_RocketTrail (vec3_t start, vec3_t end, int type);
void R_RocketTrail (int entnum, vec3_t start, vec3_t end, int type);
void R_EntityParticles (entity_t *ent);
void R_BlobExplosion (vec3_t org);
void R_ParticleExplosion (vec3_t org);
@ -178,4 +178,12 @@ void R_SetVrect (vrect_t *pvrect, vrect_t *pvrectin, int lineadj);
typedef struct mleaf_s mleaf_t;
void UQ_GL_SetupView(vec3_t origin, vec3_t angles, mleaf_t *viewLeaf);
void UQ_Game_RunParticleEffect(vec3_t origin, vec3_t direction, int color, int count);
void UQ_Game_ParticleExplosion(vec3_t origin);
void UQ_Game_ParticleExplosion2(vec3_t origin, int colorStart, int colorLength);
void UQ_Game_BlobExplosion(vec3_t origin);
void UQ_Game_TeleportSplash(vec3_t origin);
void UQ_Game_LavaSplash(vec3_t origin);
void UQ_Game_ParticleTrail(int entnum, int type, vec3_t origin);
#endif /* _QUAKE_RENDER_H */

60
engine/UniQuake/game_uniquake.c

@ -9,6 +9,11 @@ typedef struct unity_gamecalls_s
void(*RemoveEntity)(void *context, int entityNum);
void(*UpdateEntityAnimation)(void *context, int entityNum, int pose1, int pose2, float blend);
void(*SetEntitySkin)(void *context, int entityNum, int skinNum);
void(*SetEntityLighting)(void *context, int entityNum, vec3_t shadeVector, vec3_t lightColor);
void(*RunParticleEffect)(void *context, vec3_t origin, vec3_t direction, unsigned int colorMin, unsigned int colorMax, int count);
void(*CreateParticleEffect)(void *context, int type, vec3_t origin, unsigned int colorMin, unsigned int colorMax);
void(*CreateParticleTrail)(void *context, int entnum, int type, vec3_t origin);
} unity_gamecalls_t;
static void *unity_context;
@ -44,3 +49,58 @@ void UQ_Game_SetEntitySkin(int entityNum, int skinNum)
{
unity_gamecalls->SetEntitySkin(unity_context, entityNum, skinNum);
}
void UQ_Game_SetEntityLighting(int entityNum, vec3_t shadeVector, vec3_t lightColor)
{
unity_gamecalls->SetEntityLighting(unity_context, entityNum, shadeVector, lightColor);
}
void UQ_Game_RunParticleEffect(vec3_t origin, vec3_t direction, int color, int count)
{
unsigned int colorMin, colorMax;
colorMin = d_8to24table[color & ~7];
colorMax = d_8to24table[color | 7];
unity_gamecalls->RunParticleEffect(unity_context, origin, direction, colorMin, colorMax, count);
}
typedef enum
{
PARTFX_EXPLOSION = 0,
PARTFX_ROGUE_EXPLOSION,
PARTFX_BLOB_EXPLOSION,
PARTFX_LAVA_SPLASH,
PARTFX_TELEPORT_SPLASH,
} particle_effect_t;
void UQ_Game_ParticleExplosion(vec3_t origin)
{
unity_gamecalls->CreateParticleEffect(unity_context, PARTFX_EXPLOSION, origin, 0, 0);
}
void UQ_Game_ParticleExplosion2(vec3_t origin, int colorStart, int colorLength)
{
unsigned int colorMin, colorMax;
colorMin = d_8to24table[colorStart];
colorMax = d_8to24table[colorStart + colorLength - 1];
unity_gamecalls->CreateParticleEffect(unity_context, PARTFX_ROGUE_EXPLOSION, origin, colorMin, colorMax);
}
void UQ_Game_BlobExplosion(vec3_t origin)
{
unity_gamecalls->CreateParticleEffect(unity_context, PARTFX_BLOB_EXPLOSION, origin, 0, 0);
}
void UQ_Game_TeleportSplash(vec3_t origin)
{
unity_gamecalls->CreateParticleEffect(unity_context, PARTFX_TELEPORT_SPLASH, origin, 0, 0);
}
void UQ_Game_LavaSplash(vec3_t origin)
{
unity_gamecalls->CreateParticleEffect(unity_context, PARTFX_LAVA_SPLASH, origin, 0, 0);
}
void UQ_Game_ParticleTrail(int entnum, int type, vec3_t origin)
{
unity_gamecalls->CreateParticleTrail(unity_context, entnum, type, origin);
}

26
engine/Windows/VisualStudio/uniquake.vcxproj

@ -82,7 +82,7 @@
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>NotSet</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
@ -98,7 +98,7 @@
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>NotSet</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
@ -384,8 +384,8 @@
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>..\SDL2\include;..\codecs\include;..\misc\include;..\..\Quake;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;USE_SDL2;USE_CODEC_MP3;USE_CODEC_VORBIS;USE_CODEC_WAVE;USE_CODEC_FLAC;USE_CODEC_OPUS;USE_CODEC_MIKMOD;USE_CODEC_UMX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\UniQuake\stub;..\..\FMOD\inc;..\..\Quake;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>UNIQUAKE_EXPORTS;WIN32;_WINDOWS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FMOD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader />
@ -394,8 +394,8 @@
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>libvorbisfile.lib;libvorbis.lib;libopusfile.lib;libopus.lib;libFLAC.lib;libogg.lib;libmad.lib;libmikmod.lib;wsock32.lib;opengl32.lib;winmm.lib;SDL2.lib;SDL2main.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\codecs\x86;..\SDL2\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>fmod_vc.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\FMOD\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
@ -403,8 +403,7 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PostBuildEvent>
<Command>copy "$(SolutionDir)\..\codecs\x86\*.dll" "$(TargetDir)"
copy "$(SolutionDir)\..\SDL2\lib\*.dll" "$(TargetDir)"</Command>
<Command>copy "$(TargetDir)$(TargetName).dll" $(SolutionDir)..\..\..\Assets\Plugins\windows\x86\uniquake.dll</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@ -683,8 +682,8 @@ copy "$(TargetDir)$(TargetName).pdb" $(SolutionDir)..\..\..\Assets\Plugins\gamec
<ClCompile>
<Optimization>MaxSpeed</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>..\SDL2\include;..\codecs\include;..\misc\include;..\..\Quake;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USE_WINSOCK2;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_WINSOCK_DEPRECATED_NO_WARNINGS;USE_SDL2;USE_CODEC_MP3;USE_CODEC_VORBIS;USE_CODEC_WAVE;USE_CODEC_FLAC;USE_CODEC_OPUS;USE_CODEC_MIKMOD;USE_CODEC_UMX;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\UniQuake\stub;..\..\FMOD\inc;..\..\Quake;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>UNIQUAKE_EXPORTS;WIN32;_WINDOWS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FMOD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader />
@ -693,8 +692,8 @@ copy "$(TargetDir)$(TargetName).pdb" $(SolutionDir)..\..\..\Assets\Plugins\gamec
<CompileAs>CompileAsC</CompileAs>
</ClCompile>
<Link>
<AdditionalDependencies>libvorbisfile.lib;libvorbis.lib;libopusfile.lib;libopus.lib;libFLAC.lib;libogg.lib;libmad.lib;libmikmod.lib;ws2_32.lib;opengl32.lib;winmm.lib;SDL2.lib;SDL2main.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\codecs\x64;..\SDL2\lib64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>fmod_vc.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\FMOD\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
@ -702,8 +701,7 @@ copy "$(TargetDir)$(TargetName).pdb" $(SolutionDir)..\..\..\Assets\Plugins\gamec
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>copy "$(SolutionDir)\..\codecs\x64\*.dll" "$(TargetDir)"
copy "$(SolutionDir)\..\SDL2\lib64\*.dll" "$(TargetDir)"</Command>
<Command>copy "$(TargetDir)$(TargetName).dll" $(SolutionDir)..\..\..\Assets\Plugins\windows\x86_64\uniquake.dll</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Gaming.Xbox.XboxOne.x64'">

Loading…
Cancel
Save