diff --git a/Assets/Scripts/Modules/GameModule.Interop.cs b/Assets/Scripts/Modules/GameModule.Interop.cs index 71ad75b..de5e807 100644 --- a/Assets/Scripts/Modules/GameModule.Interop.cs +++ b/Assets/Scripts/Modules/GameModule.Interop.cs @@ -19,8 +19,7 @@ public partial class GameModule : CallbackHandler SetEntitySkin = CreateCallback(Callback_GameSetEntitySkin), RunParticleEffect = CreateCallback(Callback_RunParticleEffect), - ParticleExplosion = CreateCallback(Callback_ParticleExplosion), - TeleportSplash = CreateCallback(Callback_TeleportSplash), + CreateParticleEffect = CreateCallback(Callback_CreateParticleEffect), }; RegisterCallbacks(callbacks); @@ -39,8 +38,7 @@ public partial class GameModule : CallbackHandler public IntPtr SetEntitySkin; public IntPtr RunParticleEffect; - public IntPtr ParticleExplosion; - public IntPtr TeleportSplash; + public IntPtr CreateParticleEffect; } [UnmanagedFunctionPointer(CallingConvention.Cdecl)] @@ -108,26 +106,20 @@ public partial class GameModule : CallbackHandler GetSelf(context).RunParticleEffect(origin.ToUnityPosition(), direction.ToUnityPosition(), colorMin.ToColor(), colorMax.ToColor(), count); Profiler.EndSample(); } - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - private delegate void ParticleExplosionCallback(IntPtr context, ref QVec3 origin); - - [MonoPInvokeCallback(typeof(ParticleExplosionCallback))] - private static void Callback_ParticleExplosion(IntPtr context, ref QVec3 origin) - { - Profiler.BeginSample("ParticleExplosion"); - GetSelf(context).ParticleExplosion(origin.ToUnityPosition()); - Profiler.EndSample(); - } [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - private delegate void TeleportSplashCallback(IntPtr context, ref QVec3 origin); + private delegate void CreateParticleEffectCallback(IntPtr context, ParticleEffect type, ref QVec3 origin, uint colorMin, uint colorMax); - [MonoPInvokeCallback(typeof(TeleportSplashCallback))] - private static void Callback_TeleportSplash(IntPtr context, ref QVec3 origin) + [MonoPInvokeCallback(typeof(CreateParticleEffectCallback))] + private static void Callback_CreateParticleEffect(IntPtr context, ParticleEffect type, ref QVec3 origin, uint colorMin, uint colorMax) { - Profiler.BeginSample("TeleportSplash"); - GetSelf(context).TeleportSplash(origin.ToUnityPosition()); + Profiler.BeginSample("CreateParticleEffect"); + + if (type == ParticleEffect.Explosion2) + GetSelf(context).CreateParticleExplosion(origin.ToUnityPosition(), colorMin.ToColor(), colorMax.ToColor()); + else + GetSelf(context).CreateParticleEffect(type, origin.ToUnityPosition()); + Profiler.EndSample(); } } diff --git a/Assets/Scripts/Modules/GameModule.cs b/Assets/Scripts/Modules/GameModule.cs index 6b2b1d4..ef86817 100644 --- a/Assets/Scripts/Modules/GameModule.cs +++ b/Assets/Scripts/Modules/GameModule.cs @@ -73,13 +73,43 @@ public partial class GameModule uq.CurrentStyle.Particles.RunParticleEffect(position, direction, colorMin,colorMax, count, uq.GameLayer); } - private void ParticleExplosion(Vector3 position) + private void CreateParticleEffect(ParticleEffect type, Vector3 position) { - uq.CurrentStyle.Particles.CreateExplosion(position, uq.GameLayer); + switch (type) + { + case ParticleEffect.Explosion: + uq.CurrentStyle.Particles.CreateExplosion(position, uq.GameLayer); + break; + case ParticleEffect.TeleportSplash: + uq.CurrentStyle.Particles.CreateTeleportSplash(position, uq.GameLayer); + break; + } } - private void TeleportSplash(Vector3 position) + private void CreateParticleExplosion(Vector3 position, Color colorMin, Color colorMax) + { + + } + + // Should correspond to particle_effect_t in game_uniquake.c + private enum ParticleEffect + { + Explosion = 0, + Explosion2, + BlobExplosion, + LavaSplash, + TeleportSplash, + } + + // Should correspond to `int type` argument in R_RocketTrail + private enum ParticleTrail { - uq.CurrentStyle.Particles.CreateTeleportSplash(position, uq.GameLayer); + Rocket = 0, + Smoke = 1, + Blood = 2, + Tracer = 3, + SlightBlood = 4, + Tracer2 = 5, + VoreBall = 6, } } diff --git a/Assets/Styles/GLQuake/Particles/Particle.mat b/Assets/Styles/GLQuake/Particles/Particle.mat index 53ff38c..eec84ce 100644 --- a/Assets/Styles/GLQuake/Particles/Particle.mat +++ b/Assets/Styles/GLQuake/Particles/Particle.mat @@ -26,7 +26,7 @@ Material: m_LightmapFlags: 4 m_EnableInstancingVariants: 0 m_DoubleSidedGI: 0 - m_CustomRenderQueue: 3000 + m_CustomRenderQueue: 3001 stringTagMap: RenderType: Transparent disabledShaderPasses: @@ -120,7 +120,7 @@ Material: - _Mode: 0 - _OcclusionStrength: 1 - _Parallax: 0.005 - - _QueueOffset: 0 + - _QueueOffset: 1 - _ReceiveShadows: 1 - _Smoothness: 0.5 - _SmoothnessTextureChannel: 0 diff --git a/engine/UniQuake/game_uniquake.c b/engine/UniQuake/game_uniquake.c index 7ceef6a..ad6df89 100644 --- a/engine/UniQuake/game_uniquake.c +++ b/engine/UniQuake/game_uniquake.c @@ -11,8 +11,7 @@ typedef struct unity_gamecalls_s void(*SetEntitySkin)(void *context, int entityNum, int skinNum); void(*RunParticleEffect)(void *context, vec3_t origin, vec3_t direction, unsigned int colorMin, unsigned int colorMax, int count); - void(*ParticleExplosion)(void *context, vec3_t origin); - void(*TeleportSplash)(void *context, vec3_t origin); + void(*CreateParticleEffect)(void *context, int type, vec3_t origin, unsigned int colorMin, unsigned int colorMax); } unity_gamecalls_t; static void *unity_context; @@ -57,12 +56,21 @@ void UQ_Game_RunParticleEffect(vec3_t origin, vec3_t direction, int color, int c unity_gamecalls->RunParticleEffect(unity_context, origin, direction, colorMin, colorMax, count); } +typedef enum +{ + PARTFX_EXPLOSION = 0, + PARTFX_EXPLOSION2, + PARTFX_BLOB_EXPLOSION, + PARTFX_LAVA_SPLASH, + PARTFX_TELEPORT_SPLASH, +} particle_effect_t; + void UQ_Game_ParticleExplosion(vec3_t origin) { - unity_gamecalls->ParticleExplosion(unity_context, origin); + unity_gamecalls->CreateParticleEffect(unity_context, PARTFX_EXPLOSION, origin, 0, 0); } void UQ_Game_TeleportSplash(vec3_t origin) { - unity_gamecalls->TeleportSplash(unity_context, origin); + unity_gamecalls->CreateParticleEffect(unity_context, PARTFX_TELEPORT_SPLASH, origin, 0, 0); }