From fae4bc09e571cc3d8fa8a647f2bc7cea020978fc Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Wed, 18 Jan 2023 17:33:09 -0800 Subject: [PATCH] NSProjectile: some touchups in regards to the Spawned() method. --- src/client/entry.qc | 1 + src/client/modelevent.qc | 8 ++++---- src/server/NSTraceAttack.qc | 1 + src/shared/NSIO.qc | 6 ++++-- src/shared/NSProjectile.h | 15 +++++++-------- src/shared/NSProjectile.qc | 19 ++++++++----------- src/shared/surfaceproperties.qc | 2 +- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/client/entry.qc b/src/client/entry.qc index dcb88c56..028d447c 100644 --- a/src/client/entry.qc +++ b/src/client/entry.qc @@ -165,6 +165,7 @@ CSQC_Update2D(float w, float h, bool focus) self = cl; if (Util_GetMaxPlayers() > 1 && !VGUI_Active() && (Client_InIntermission() || (!cl.IsFakeSpectator() && cl.IsDead()))) { + HUD_Draw(); Scores_Draw(); Chat_Draw(); Print_Draw(); diff --git a/src/client/modelevent.qc b/src/client/modelevent.qc index 3361a307..f2c0d144 100644 --- a/src/client/modelevent.qc +++ b/src/client/modelevent.qc @@ -48,22 +48,22 @@ Event_ProcessModel(float flTimeStamp, int iCode, string strData) break; case 5001: /* muzzle flash on attachment 0 */ pSeat->m_eMuzzleflash.alpha = 1.0f; - pSeat->m_eMuzzleflash.scale = 0.25; + pSeat->m_eMuzzleflash.scale = 0.5; pSeat->m_eMuzzleflash.skin = pSeat->m_iVMBones; break; case 5011: /* muzzle flash on attachment 1 */ pSeat->m_eMuzzleflash.alpha = 1.0f; - pSeat->m_eMuzzleflash.scale = 0.25; + pSeat->m_eMuzzleflash.scale = 0.5; pSeat->m_eMuzzleflash.skin = pSeat->m_iVMBones + 1; break; case 5021: /* muzzle flash on attachment 2 */ pSeat->m_eMuzzleflash.alpha = 1.0f; - pSeat->m_eMuzzleflash.scale = 0.25; + pSeat->m_eMuzzleflash.scale = 0.5; pSeat->m_eMuzzleflash.skin = pSeat->m_iVMBones + 2; break; case 5031: /* muzzle flash on attachment 3 */ pSeat->m_eMuzzleflash.alpha = 1.0f; - pSeat->m_eMuzzleflash.scale = 0.25; + pSeat->m_eMuzzleflash.scale = 0.5; pSeat->m_eMuzzleflash.skin = pSeat->m_iVMBones + 3; break; default: diff --git a/src/server/NSTraceAttack.qc b/src/server/NSTraceAttack.qc index 4e198b72..483f4b3d 100644 --- a/src/server/NSTraceAttack.qc +++ b/src/server/NSTraceAttack.qc @@ -126,6 +126,7 @@ NSTraceAttack::_FireSingle(vector vecPos, vector vecAngles, float flDamage, floa if (trace_ent.iBleeds == 0) { if (m_strDecalGroup) DecalGroups_Place(m_strDecalGroup, trace_endpos + (v_forward * -2)); + SurfData_Impact(trace_ent, trace_surfaceflagsi, trace_endpos, trace_plane_normal); } diff --git a/src/shared/NSIO.qc b/src/shared/NSIO.qc index e570b3af..8dfedbec 100644 --- a/src/shared/NSIO.qc +++ b/src/shared/NSIO.qc @@ -50,6 +50,7 @@ NSIO::Respawn(void) void NSIO::Init(void) { + if (__fullspawndata) { /* annoylingly our starting offsets differ */ #ifdef CLIENT for (int i = 0; i < (tokenize(__fullspawndata) - 1); i += 2) @@ -58,13 +59,13 @@ NSIO::Init(void) for (int i = 1; i < (tokenize(__fullspawndata) - 1); i += 2) SpawnKey(argv(i), argv(i+1)); #endif + } -#ifdef SERVER /* some entity might involuntarily call SpawnInit as part of being a member of NSIO. So we need to make sure that it doesn't inherit stuff from the last previously loaded entity */ __fullspawndata = ""; -#endif + Spawned(); /* entity may be marked as deleted */ @@ -76,6 +77,7 @@ NSIO::Init(void) if (g_isloading == true) return; #endif + Respawn(); } diff --git a/src/shared/NSProjectile.h b/src/shared/NSProjectile.h index 9b65d9f5..3c939a67 100644 --- a/src/shared/NSProjectile.h +++ b/src/shared/NSProjectile.h @@ -31,15 +31,14 @@ private: public: void NSProjectile(void); - /* overrides */ - virtual void SetModel(string); /* FIXME: Is this meant to be overridable? */ - /** Sets the function that'll be called upon impact of the projectile onto a surface. */ - virtual void SetImpact(void(entity, entity)); + nonvirtual void SetImpact(void(entity, entity)); + /** When called, will animated between two frame positions at a specified framerate on loop. */ + nonvirtual void Animate(int, int, float); + /** When called, will animated between two frame positions at a specified framerate and remove itself when it has finished playing the sequence. */ + nonvirtual void AnimateOnce(int, int, float); + /** Called upon the projectile touching another object. */ - virtual void ProjectileTouch(void); - /** When called, will animated between two frame positions at a specified framerate. */ - virtual void Animate(int, int, float); - virtual void AnimateOnce(int, int, float); + virtual void Touch(entity); virtual void Spawned(void); }; diff --git a/src/shared/NSProjectile.qc b/src/shared/NSProjectile.qc index e0b5d080..26a2eb44 100644 --- a/src/shared/NSProjectile.qc +++ b/src/shared/NSProjectile.qc @@ -25,19 +25,22 @@ NSProjectile::NSProjectile(void) void NSProjectile::Spawned(void) { - touch = ProjectileTouch; + super::Spawned(); + SetMovetype(MOVETYPE_FLYMISSILE); SetRenderColor([1,1,1]); SetRenderAmt(1.0); SetSolid(SOLID_BBOX); - hitcontentsmaski |= CONTENTBIT_PROJECTILE; + SetRenderAmt(1.0f); + SetRenderColor([1.0,1.0,1.0]); + SetSize([0,0,0], [0,0,0]); } void -NSProjectile::ProjectileTouch(void) +NSProjectile::Touch(entity eToucher) { if (m_pImpact) - m_pImpact(other, this); + m_pImpact(eToucher, this); Destroy(); } @@ -46,13 +49,7 @@ void NSProjectile::SetImpact(void(entity a,entity b) func) { m_pImpact = func; -} - -void -NSProjectile::SetModel(string mdl) -{ - super::SetModel(mdl); - SetSize([0,0,0], [0,0,0]); + Spawned(); } void diff --git a/src/shared/surfaceproperties.qc b/src/shared/surfaceproperties.qc index 5312d756..82742e95 100644 --- a/src/shared/surfaceproperties.qc +++ b/src/shared/surfaceproperties.qc @@ -401,7 +401,7 @@ void SurfData_Impact_Net(entity e, vector org) { #ifdef CLIENT - string tex_name = getsurfacetexture(world, getsurfacenearpoint(world, org)); + string tex_name = getsurfacetexture(e, getsurfacenearpoint(e, org)); string impactsfx = SurfData_GetInfo(SurfData_TexToSurfData(tex_name), SURFDATA_SND_BULLETIMPACT);