NSProjectile: some touchups in regards to the Spawned() method.

This commit is contained in:
Marco Cawthorne 2023-01-18 17:33:09 -08:00
parent d562533111
commit fae4bc09e5
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
7 changed files with 26 additions and 26 deletions

View File

@ -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();

View File

@ -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:

View File

@ -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);
}

View File

@ -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();
}

View File

@ -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);
};

View File

@ -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

View File

@ -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);