NSProjectile: Respect 'offset' spawn key.

This commit is contained in:
Marco Cawthorne 2023-07-27 23:19:48 -07:00
parent 2656593203
commit 9a1f5e3af1
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
2 changed files with 13 additions and 3 deletions

View File

@ -94,7 +94,7 @@ private:
vector m_vecSpawnMins; vector m_vecSpawnMins;
vector m_vecSpawnMaxs; vector m_vecSpawnMaxs;
float m_flSpawnFrame; float m_flSpawnFrame;
bool m_bInheritVelocity; vector m_vecSpawnOrigin;
/* ETQW-additions */ /* ETQW-additions */
bool m_bIsBullet; bool m_bIsBullet;
@ -103,6 +103,7 @@ private:
bool m_bStickToWorld; bool m_bStickToWorld;
bool m_bStickToActor; bool m_bStickToActor;
bool m_bThrustHoming; bool m_bThrustHoming;
bool m_bInheritVelocity;
NSTimer m_thrustHandler; NSTimer m_thrustHandler;

View File

@ -60,6 +60,7 @@ NSProjectile::NSProjectile(void)
m_vecSpawnMins = g_vec_null; m_vecSpawnMins = g_vec_null;
m_vecSpawnMaxs = g_vec_null; m_vecSpawnMaxs = g_vec_null;
m_flSpawnFrame = 0; m_flSpawnFrame = 0;
m_vecSpawnOrigin = g_vec_null;
/* ETQW-additions */ /* ETQW-additions */
m_bIsBullet = false; m_bIsBullet = false;
@ -229,6 +230,9 @@ NSProjectile::SpawnKey(string strKey, string strValue)
case "inherit_velocity": case "inherit_velocity":
m_bInheritVelocity = ReadBool(strValue); m_bInheritVelocity = ReadBool(strValue);
break; break;
case "offset":
m_vecSpawnOrigin = ReadVector(strValue);
break;
default: default:
super::SpawnKey(strKey, strValue); super::SpawnKey(strKey, strValue);
break; break;
@ -588,7 +592,7 @@ NSProjectile::_Explode(void)
vector explodePos = origin - (v_forward * 32); vector explodePos = origin - (v_forward * 32);
if (m_partModelDetonate) if (m_partModelDetonate)
pointparticles(particleeffectnum(m_partModelDetonate), explodePos, velocity, 1); pointparticles(particleeffectnum(m_partModelDetonate), explodePos, trace_plane_normal, 1);
//print(sprintf("%S\n", m_defSplashDamage)); //print(sprintf("%S\n", m_defSplashDamage));
if (m_defSplashDamage) { if (m_defSplashDamage) {
@ -676,7 +680,6 @@ NSProjectile::Launch(vector startPos, vector launchDir, float fuseOffset, float
return; return;
} }
SetOrigin(startPos);
SetAngles(launchDir); SetAngles(launchDir);
SetModel(m_oldModel); SetModel(m_oldModel);
SetSize(m_vecSpawnMins, m_vecSpawnMaxs); SetSize(m_vecSpawnMins, m_vecSpawnMaxs);
@ -695,6 +698,11 @@ NSProjectile::Launch(vector startPos, vector launchDir, float fuseOffset, float
moveVel += (m_vecLaunchVelocity[1] * powerMultiplier) * v_right; moveVel += (m_vecLaunchVelocity[1] * powerMultiplier) * v_right;
moveVel += (m_vecLaunchVelocity[2] * powerMultiplier) * v_up; moveVel += (m_vecLaunchVelocity[2] * powerMultiplier) * v_up;
startPos += v_forward * m_vecSpawnOrigin[0];
startPos += v_right * m_vecSpawnOrigin[1];
startPos += v_up * m_vecSpawnOrigin[2];
SetOrigin(startPos);
if (m_bInheritVelocity == true) if (m_bInheritVelocity == true)
moveVel += owner.velocity; moveVel += owner.velocity;
@ -735,6 +743,7 @@ NSProjectile::Launch(vector startPos, vector launchDir, float fuseOffset, float
} }
SetFrame(m_flSpawnFrame); SetFrame(m_flSpawnFrame);
SetGravity(m_flGravity);
StartSoundDef(m_sndFly, CHAN_BODY, true); StartSoundDef(m_sndFly, CHAN_BODY, true);
SendFlags = (-1); SendFlags = (-1);
//SendEntity = 0; /* HACK: remove this once Spike fixes CSQC-set traileffectnum etc. */ //SendEntity = 0; /* HACK: remove this once Spike fixes CSQC-set traileffectnum etc. */