Browse Source

Recreated the teleport splash particle effect

readme
Nico de Poel 5 years ago
parent
commit
946b8572d4
  1. 13
      Assets/Scripts/Modules/GameModule.Interop.cs
  2. 5
      Assets/Scripts/Modules/GameModule.cs
  3. 13
      Assets/Scripts/VisualStyle.cs
  4. 2
      Assets/Styles/GLQuake/GLQuake.asset
  5. 4
      Assets/Styles/GLQuake/Particles/Particle.mat
  6. 4864
      Assets/Styles/GLQuake/Particles/TeleportSplash.prefab
  7. 7
      Assets/Styles/GLQuake/Particles/TeleportSplash.prefab.meta
  8. 2
      engine/Quake/r_part.c
  9. 1
      engine/Quake/render.h
  10. 6
      engine/UniQuake/game_uniquake.c

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

@ -20,6 +20,7 @@ public partial class GameModule : CallbackHandler<GameModule>
RunParticleEffect = CreateCallback<RunParticleEffectCallback>(Callback_RunParticleEffect), RunParticleEffect = CreateCallback<RunParticleEffectCallback>(Callback_RunParticleEffect),
ParticleExplosion = CreateCallback<ParticleExplosionCallback>(Callback_ParticleExplosion), ParticleExplosion = CreateCallback<ParticleExplosionCallback>(Callback_ParticleExplosion),
TeleportSplash = CreateCallback<TeleportSplashCallback>(Callback_TeleportSplash),
}; };
RegisterCallbacks(callbacks); RegisterCallbacks(callbacks);
@ -39,6 +40,7 @@ public partial class GameModule : CallbackHandler<GameModule>
public IntPtr RunParticleEffect; public IntPtr RunParticleEffect;
public IntPtr ParticleExplosion; public IntPtr ParticleExplosion;
public IntPtr TeleportSplash;
} }
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
@ -117,4 +119,15 @@ public partial class GameModule : CallbackHandler<GameModule>
GetSelf(context).ParticleExplosion(origin.ToUnityPosition()); GetSelf(context).ParticleExplosion(origin.ToUnityPosition());
Profiler.EndSample(); Profiler.EndSample();
} }
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate void TeleportSplashCallback(IntPtr context, ref QVec3 origin);
[MonoPInvokeCallback(typeof(TeleportSplashCallback))]
private static void Callback_TeleportSplash(IntPtr context, ref QVec3 origin)
{
Profiler.BeginSample("TeleportSplash");
GetSelf(context).TeleportSplash(origin.ToUnityPosition());
Profiler.EndSample();
}
} }

5
Assets/Scripts/Modules/GameModule.cs

@ -77,4 +77,9 @@ public partial class GameModule
{ {
uq.CurrentStyle.Particles.CreateExplosion(position, uq.GameLayer); uq.CurrentStyle.Particles.CreateExplosion(position, uq.GameLayer);
} }
private void TeleportSplash(Vector3 position)
{
uq.CurrentStyle.Particles.CreateTeleportSplash(position, uq.GameLayer);
}
} }

13
Assets/Scripts/VisualStyle.cs

@ -158,6 +158,9 @@ public class ParticleSystems
[SerializeField] [SerializeField]
protected ParticleSystem explosion; protected ParticleSystem explosion;
[SerializeField]
protected ParticleSystem teleportSplash;
public virtual void RunParticleEffect(Vector3 position, Vector3 direction, Color colorMin, Color colorMax, int count, Layers layer) public virtual void RunParticleEffect(Vector3 position, Vector3 direction, Color colorMin, Color colorMax, int count, Layers layer)
{ {
if (particleEffect == null) if (particleEffect == null)
@ -194,6 +197,16 @@ public class ParticleSystems
effect.transform.position = position; effect.transform.position = position;
} }
public virtual void CreateTeleportSplash(Vector3 position, Layers layer)
{
if (teleportSplash == null)
return;
var effect = Object.Instantiate(teleportSplash);
SetLayer(effect.gameObject, layer);
effect.transform.position = position;
}
protected static void SetLayer(GameObject go, Layers layer) protected static void SetLayer(GameObject go, Layers layer)
{ {
go.layer = (int)layer; go.layer = (int)layer;

2
Assets/Styles/GLQuake/GLQuake.asset

@ -27,3 +27,5 @@ MonoBehaviour:
type: 3} type: 3}
explosion: {fileID: 9150008102338277659, guid: 94e2cf23692eef24d9a5145b0f705c55, explosion: {fileID: 9150008102338277659, guid: 94e2cf23692eef24d9a5145b0f705c55,
type: 3} type: 3}
teleportSplash: {fileID: 9150008102338277659, guid: 79bef89ba1457cb42a9fbeaf4acff66f,
type: 3}

4
Assets/Styles/GLQuake/Particles/Particle.mat

@ -26,7 +26,7 @@ Material:
m_LightmapFlags: 4 m_LightmapFlags: 4
m_EnableInstancingVariants: 0 m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0 m_DoubleSidedGI: 0
m_CustomRenderQueue: 2999
m_CustomRenderQueue: 3000
stringTagMap: stringTagMap:
RenderType: Transparent RenderType: Transparent
disabledShaderPasses: disabledShaderPasses:
@ -120,7 +120,7 @@ Material:
- _Mode: 0 - _Mode: 0
- _OcclusionStrength: 1 - _OcclusionStrength: 1
- _Parallax: 0.005 - _Parallax: 0.005
- _QueueOffset: -1
- _QueueOffset: 0
- _ReceiveShadows: 1 - _ReceiveShadows: 1
- _Smoothness: 0.5 - _Smoothness: 0.5
- _SmoothnessTextureChannel: 0 - _SmoothnessTextureChannel: 0

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

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

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

2
engine/Quake/r_part.c

@ -608,6 +608,8 @@ void R_TeleportSplash (vec3_t org)
vel = 50 + (rand()&63); vel = 50 + (rand()&63);
VectorScale (dir, vel, p->vel); VectorScale (dir, vel, p->vel);
} }
UQ_Game_TeleportSplash(org);
} }
/* /*

1
engine/Quake/render.h

@ -180,5 +180,6 @@ 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_RunParticleEffect(vec3_t origin, vec3_t direction, int color, int count);
void UQ_Game_ParticleExplosion(vec3_t origin); void UQ_Game_ParticleExplosion(vec3_t origin);
void UQ_Game_TeleportSplash(vec3_t origin);
#endif /* _QUAKE_RENDER_H */ #endif /* _QUAKE_RENDER_H */

6
engine/UniQuake/game_uniquake.c

@ -12,6 +12,7 @@ typedef struct unity_gamecalls_s
void(*RunParticleEffect)(void *context, vec3_t origin, vec3_t direction, unsigned int colorMin, unsigned int colorMax, int count); 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(*ParticleExplosion)(void *context, vec3_t origin);
void(*TeleportSplash)(void *context, vec3_t origin);
} unity_gamecalls_t; } unity_gamecalls_t;
static void *unity_context; static void *unity_context;
@ -60,3 +61,8 @@ void UQ_Game_ParticleExplosion(vec3_t origin)
{ {
unity_gamecalls->ParticleExplosion(unity_context, origin); unity_gamecalls->ParticleExplosion(unity_context, origin);
} }
void UQ_Game_TeleportSplash(vec3_t origin)
{
unity_gamecalls->TeleportSplash(unity_context, origin);
}
Loading…
Cancel
Save