Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions Game.Server/BaseCombatWeapon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,36 @@ public override void Use(BaseEntity? activator, BaseEntity? caller, UseType useT
public override bool IsWeapon() => true;
public override GarrysMod.LuaClass Lua_GetLuaClass() => GarrysMod.LuaEntity.LC_Weapon;

public static short g_sModelIndexLaser;
public const string g_pModelNameLaser = "sprites/laserbeam.vmt";
public static short g_sModelIndexFireball;
public static short g_sModelIndexSmoke;
public static short g_sModelIndexBubbles;

public static void W_Precache() {
WeaponParse.PrecacheFileWeaponInfoDatabase(filesystem);

g_sModelIndexFireball = -1;

g_sModelIndexSmoke = (short)PrecacheModel("sprites/steam1.vmt");
g_sModelIndexBubbles = (short)PrecacheModel("sprites/bubble.vmt");
g_sModelIndexLaser = (short)PrecacheModel(g_pModelNameLaser);

PrecacheParticleSystem("blood_impact_red_01");
PrecacheParticleSystem("blood_impact_green_01");
PrecacheParticleSystem("blood_impact_yellow_01");
#if GMOD_DLL
PrecacheParticleSystem("blood_impact_antlion_01");
PrecacheParticleSystem("blood_impact_zombie_01");
PrecacheParticleSystem("blood_impact_antlion_worker_01");
#endif

PrecacheModel("effects/bubble.vmt");

PrecacheModel("models/weapons/w_bullet.mdl");

PrecacheScriptSound("BaseCombatWeapon.WeaponDrop");
PrecacheScriptSound("BaseCombatWeapon.WeaponMaterialize");
}

public virtual Capability CapabilitiesGet() => 0;
Expand Down
17 changes: 16 additions & 1 deletion Game.Server/BaseTempEntity.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@

using Source.Common;
using Source.Common.Mathematics;

using System.Numerics;

namespace Game.Server;

Expand All @@ -25,10 +28,22 @@ public void Create<IRF>(scoped ref IRF filter, float delay) where IRF : IRecipie
}

public static BaseTempEntity? GetList() => s_pTempEntities;
public ReadOnlySpan<char> GetName() => Name;
public BaseTempEntity? GetNext() => Next;

public void Precache(){
public virtual void Precache(){

}

public virtual void Test(in Vector3 current_origin, in QAngle current_angles) {
Msg($"{Name}\n");
MathLib.AngleVectors(current_angles, out Vector3 forward);

MathLib.VectorMA(current_origin, 20, forward, out Vector3 origin);

BroadcastRecipientFilter filter = new();

Create(ref filter, 0.0f);
}

public static void PrecacheTempEnts() {
Expand Down
118 changes: 79 additions & 39 deletions Game.Server/TE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

using Game.Shared;

using Source;
using Source.Common;
using Source.Common.Formats.Keyvalues;
using Source.Common.Mathematics;
Expand Down Expand Up @@ -38,71 +39,88 @@ public bool SuppressTE<IRF>(scoped ref IRF filter) where IRF : IRecipientFilter
}

public override void ArmorRicochet<IRF>(scoped ref IRF filer, float delay, in Vector3 pos, in Vector3 dir) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_ArmorRicochet(ref filer, delay, pos, dir);
}

public override void BeamEntPoint<IRF>(scoped ref IRF filer, float delay, int nStartEntity, in Vector3 start, int nEndEntity, in Vector3 end, int modelindex, int haloindex, int startframe, int framerate, float life, float width, float endWidth, int fadeLength, float amplitude, int r, int g, int b, int a, int speed) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_BeamEntPoint(ref filer, delay, nStartEntity, start, nEndEntity, end, modelindex, haloindex, startframe, framerate, life, width, endWidth, fadeLength, amplitude, r, g, b, a, speed);
}

public override void BeamEnts<IRF>(scoped ref IRF filer, float delay, int start, int end, int modelindex, int haloindex, int startframe, int framerate, float life, float width, float endWidth, int fadeLength, float amplitude, int r, int g, int b, int a, int speed) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_BeamEnts(ref filer, delay, start, end, modelindex, haloindex, startframe, framerate, life, width, endWidth, fadeLength, amplitude, r, g, b, a, speed);
}

public override void BeamFollow<IRF>(scoped ref IRecipientFilter filter, float delay, int iEntIndex, int modelIndex, int haloIndex, float life, float width, float endWidth, float fadeLength, float r, float g, float b, float a) {
throw new NotImplementedException();
if (!SuppressTE(ref filter))
TE_BeamFollow(ref filter, delay, iEntIndex, modelIndex, haloIndex, life, width, endWidth, fadeLength, r, g, b, a);
}

public override void BeamLaser<IRF>(scoped ref IRF filer, float delay, int start, int end, int modelindex, int haloindex, int startframe, int framerate, float life, float width, float endWidth, int fadeLength, float amplitude, int r, int g, int b, int a, int speed) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_BeamLaser(ref filer, delay, start, end, modelindex, haloindex, startframe, framerate, life, width, endWidth, fadeLength, amplitude, r, g, b, a, speed);
}

public override void BeamPoints<IRF>(scoped ref IRF filer, float delay, in Vector3 start, in Vector3 end, int modelindex, int haloindex, int startframe, int framerate, float life, float width, float endWidth, int fadeLength, float amplitude, int r, int g, int b, int a, int speed) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_BeamPoints(ref filer, delay, start, end, modelindex, haloindex, startframe, framerate, life, width, endWidth, fadeLength, amplitude, r, g, b, a, speed);
}

public override void BeamRing<IRF>(scoped ref IRF filer, float delay, int start, int end, int modelindex, int haloindex, int startframe, int framerate, float life, float width, int spread, float amplitude, int r, int g, int b, int a, int speed, int flags = 0) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_BeamRing(ref filer, delay, start, end, modelindex, haloindex, startframe, framerate, life, width, spread, amplitude, r, g, b, a, speed, flags);
}

public override void BeamRingPoint<IRF>(scoped ref IRF filer, float delay, in Vector3 center, float start_radius, float end_radius, int modelindex, int haloindex, int startframe, int framerate, float life, float width, int spread, float amplitude, int r, int g, int b, int a, int speed, int flags = 0) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_BeamRingPoint(ref filer, delay, center, start_radius, end_radius, modelindex, haloindex, startframe, framerate, life, width, spread, amplitude, r, g, b, a, speed, flags);
}

public override void BeamSpline<IRF>(scoped ref IRF filer, float delay, int points, Span<Vector3> rgPoints) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_BeamSpline(ref filer, delay, points, rgPoints);
}

public override void BloodSprite<IRF>(scoped ref IRF filer, float delay, in Vector3 org, in Vector3 dir, int r, int g, int b, int a, int size) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_BloodSprite(ref filer, delay, org, dir, r, g, b, a, size);
}

public override void BloodStream<IRF>(scoped ref IRF filer, float delay, in Vector3 org, in Vector3 dir, int r, int g, int b, int a, int amount) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_BloodStream(ref filer, delay, org, dir, r, g, b, a, amount);
}

public override void BreakModel<IRF>(scoped ref IRF filer, float delay, in Vector3 pos, in QAngle angle, in Vector3 size, in Vector3 vel, int modelindex, int randomization, int count, float time, int flags) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_BreakModel(ref filer, delay, pos, angle, size, vel, modelindex, randomization, count, time, flags);
}

public override void BSPDecal<IRF>(scoped ref IRF filer, float delay, in Vector3 pos, int entity, int index) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_BSPDecal(ref filer, delay, pos, entity, index);
}

public override void Bubbles<IRF>(scoped ref IRF filer, float delay, in Vector3 mins, in Vector3 maxs, float height, int modelindex, int count, float speed) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_Bubbles(ref filer, delay, mins, maxs, height, modelindex, count, speed);
}

public override void BubbleTrail<IRF>(scoped ref IRF filer, float delay, in Vector3 mins, in Vector3 maxs, float height, int modelindex, int count, float speed) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_BubbleTrail(ref filer, delay, mins, maxs, height, modelindex, count, speed);
}

public override void ClientProjectile<IRF>(scoped ref IRF filter, float delay, in Vector3 vecOrigin, in Vector3 vecVelocity, int modelindex, int lifetime, BaseEntity? owner) {
throw new NotImplementedException();
if (!SuppressTE(ref filter))
TE_ClientProjectile(ref filter, delay, vecOrigin, vecVelocity, modelindex, lifetime, owner);
}

public override void Decal<IRF>(scoped ref IRF filer, float delay, in Vector3 pos, in Vector3 start, int entity, int hitbox, int index) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_Decal(ref filer, delay, pos, start, entity, hitbox, index);
}

public override void DispatchEffect<IRF>(scoped ref IRF filter, float delay, in Vector3 pos, ReadOnlySpan<char> name, EffectData data) {
Expand All @@ -116,39 +134,50 @@ public override void Dust<IRF>(scoped ref IRF filer, float delay, in Vector3 pos
}

public override void DynamicLight<IRF>(scoped ref IRF filer, float delay, in Vector3 org, int r, int g, int b, int exponent, float radius, float time, float decay) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_DynamicLight(ref filer, delay, org, r, g, b, exponent, radius, time, decay);
}

public override void EnergySplash<IRF>(scoped ref IRF filer, float delay, in Vector3 pos, in Vector3 dir, bool bExplosive) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_EnergySplash(ref filer, delay, pos, dir, bExplosive);
}

public override void Explosion<IRF>(scoped ref IRF filer, float delay, in Vector3 pos, int modelindex, float scale, int framerate, int flags, int radius, int magnitude, Vector3? normal = null, byte materialType = 67) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_Explosion(ref filer, delay, pos, modelindex, scale, framerate, flags, radius, magnitude, normal, materialType);
}

public override void Fizz<IRF>(scoped ref IRF filer, float delay, BaseEntity? ed, int modelindex, int density, int current) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_Fizz(ref filer, delay, ed, modelindex, density, current);
}

public override void FootprintDecal<IRF>(scoped ref IRF filer, float delay, in Vector3 origin, in Vector3 right, int entity, int index, byte materialType) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_FootprintDecal(ref filer, delay, origin, right, entity, index, materialType);
}

public override void GaussExplosion<IRF>(scoped ref IRF filer, float delay, in Vector3 pos, in Vector3 dir, int type) {
throw new NotImplementedException();
#if HL2_DLL
if (!SuppressTE(ref filer))
TE_GaussExplosion(ref filer, delay, pos, dir, type);
#endif
}

public override void GlowSprite<IRF>(scoped ref IRF filer, float delay, in Vector3 pos, int modelindex, float life, float size, int brightness) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_GlowSprite(ref filer, delay, pos, modelindex, life, size, brightness);
}

public override void KillPlayerAttachments<IRF>(scoped ref IRF filer, float delay, int player) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_KillPlayerAttachments(ref filer, delay, player);
}

public override void LargeFunnel<IRF>(scoped ref IRF filer, float delay, in Vector3 pos, int modelindex, int reversed) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_LargeFunnel(ref filer, delay, pos, modelindex, reversed);
}

public override void MetalSparks<IRF>(scoped ref IRF filer, float delay, in Vector3 pos, in Vector3 dir) {
Expand All @@ -157,50 +186,61 @@ public override void MetalSparks<IRF>(scoped ref IRF filer, float delay, in Vect
}

public override void MuzzleFlash<IRF>(scoped ref IRF filer, float delay, in Vector3 start, in QAngle angles, float scale, int type) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_MuzzleFlash(ref filer, delay, start, angles, scale, type);
}

public override void PhysicsProp<IRF>(scoped ref IRF filter, float delay, int modelindex, int skin, in Vector3 pos, in QAngle angles, in Vector3 vel, int flags, int effects) {
throw new NotImplementedException();
public override void PhysicsProp<IRF>(scoped ref IRF filter, float delay, int modelindex, int skin, in Vector3 pos, in QAngle angles, in Vector3 vel, int flags, int effects, Color clrRender, float modelScale) {
if (!SuppressTE(ref filter))
TE_PhysicsProp(ref filter, delay, modelindex, skin, pos, angles, vel, flags, effects, clrRender, modelScale);
}

public override void PlayerDecal<IRF>(scoped ref IRF filer, float delay, in Vector3 pos, int player, int entity) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_PlayerDecal(ref filer, delay, pos, player, entity);
}

public override void ProjectDecal<IRF>(scoped ref IRF filter, float delay, in Vector3 pos, in QAngle angles, float distance, int index) {
throw new NotImplementedException();
if (!SuppressTE(ref filter))
TE_ProjectDecal(ref filter, delay, pos, angles, distance, index);
}

public override void ShatterSurface<IRF>(scoped ref IRF filer, float delay, in Vector3 pos, in QAngle angle, in Vector3 force, in Vector3 forcePos, float width, float height, float shardsize, ShatterSurface surfacetype, int front_r, int front_g, int front_b, int back_r, int back_g, int back_b) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_ShatterSurface(ref filer, delay, pos, angle, force, forcePos, width, height, shardsize, surfacetype, front_r, front_g, front_b, back_r, back_g, back_b);
}

public override void ShowLine<IRF>(scoped ref IRF filer, float delay, in Vector3 start, in Vector3 end) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_ShowLine(ref filer, delay, start, end);
}

public override void Smoke<IRF>(scoped ref IRF filer, float delay, in Vector3 pos, int modelindex, float scale, int framerate) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_Smoke(ref filer, delay, pos, modelindex, scale, framerate);
}

public override void Sparks<IRF>(scoped ref IRF filer, float delay, in Vector3 pos, int nMagnitude, int nTrailLength, in Vector3 pDir) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_Sparks(ref filer, delay, pos, nMagnitude, nTrailLength, pDir);
}

public override void Sprite<IRF>(scoped ref IRF filer, float delay, in Vector3 pos, int modelindex, float size, int brightness) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_Sprite(ref filer, delay, pos, modelindex, size, brightness);
}

public override void SpriteSpray<IRF>(scoped ref IRF filer, float delay, in Vector3 pos, in Vector3 dir, int modelindex, int speed, float noise, int count) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_SpriteSpray(ref filer, delay, pos, dir, modelindex, speed, noise, count);
}

public override void TriggerTempEntity(KeyValues pKeyValues) {
throw new NotImplementedException();
Assert(false);
}

public override void WorldDecal<IRF>(scoped ref IRF filer, float delay, in Vector3 pos, int index) {
throw new NotImplementedException();
if (!SuppressTE(ref filer))
TE_WorldDecal(ref filer, delay, pos, index);
}
}
5 changes: 5 additions & 0 deletions Game.Server/TEAntlionDust.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Source.Common;
using Source.Common.Mathematics;
using Source;
using Game.Shared;
using System.Numerics;
Expand All @@ -17,4 +18,8 @@ public partial class TEAntlionDust(ReadOnlySpan<char> name) : TEParticleSystem(n
public Vector3 Angles;
[NetworkVar("m_bBlockedSpawner")]
public bool BlockedSpawner;

// todo: UTIL_CreateAntlionDust sender (hl2/antlion_dust.cpp)

public override void Test(in Vector3 current_origin, in QAngle current_angles) { }
}
12 changes: 12 additions & 0 deletions Game.Server/TEArmorRicochet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,15 @@ public partial class TEArmorRicochet(ReadOnlySpan<char> name) : TEMetalSparks(na
];

}

public static partial class TempEnts
{
static readonly TEArmorRicochet g_TEArmorRicochet = new("Armor Ricochet");

public static void TE_ArmorRicochet<IRF>(scoped ref IRF filter, float delay, in Vector3 pos, in Vector3 dir) where IRF : IRecipientFilter {
g_TEArmorRicochet.Pos = pos;
g_TEArmorRicochet.Dir = dir;

g_TEArmorRicochet.Create(ref filter, delay);
}
}
37 changes: 37 additions & 0 deletions Game.Server/TEBSPDecal.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using Source.Common;
using Source.Common.Formats.BSP;
using Source.Common.Mathematics;
using Source;
using Game.Shared;
using System.Numerics;
Expand All @@ -19,4 +21,39 @@ public partial class TEBSPDecal(ReadOnlySpan<char> name) : BaseTempEntity(name)
public int Entity;
[NetworkVar("m_nIndex")]
public int Index;

public override void Test(in Vector3 current_origin, in QAngle current_angles) {
Entity = 0;
Index = 0;
Origin = current_origin;

Origin.Z += 24;

MathLib.AngleVectors(current_angles, out Vector3 forward);
forward.Z = 0.0f;
MathLib.VectorNormalize(ref forward);

Origin += forward * 50.0f;
Vector3 vecEnd = Origin + forward * 1024.0f;

Util.TraceLine(Origin, vecEnd, Mask.SolidBrushOnly, null, Source.CollisionGroup.None, out Trace tr);

Origin = tr.EndPos;

BroadcastRecipientFilter filter = new();
Create(ref filter, 0.0f);
}
}

public static partial class TempEnts
{
static readonly TEBSPDecal g_TEBSPDecal = new("BSP Decal");

public static void TE_BSPDecal<IRF>(scoped ref IRF filter, float delay, in Vector3 pos, int entity, int index) where IRF : IRecipientFilter {
g_TEBSPDecal.Origin = pos;
g_TEBSPDecal.Entity = entity;
g_TEBSPDecal.Index = index;

g_TEBSPDecal.Create(ref filter, delay);
}
}
Loading
Loading