Get rid of FX_GibHuman and FX_GibAlien, use PropData system instead
This commit is contained in:
parent
e49810be8b
commit
24964d27c9
8 changed files with 9 additions and 219 deletions
|
@ -34,30 +34,6 @@ ClientGame_EventParse(float fHeader)
|
||||||
vSparkAngle[2] = readcoord();
|
vSparkAngle[2] = readcoord();
|
||||||
FX_Spark(vSparkPos, vSparkAngle);
|
FX_Spark(vSparkPos, vSparkAngle);
|
||||||
break;
|
break;
|
||||||
case EV_GIBHUMAN:
|
|
||||||
vector vGibPos = g_vec_null;
|
|
||||||
vGibPos[0] = readcoord();
|
|
||||||
vGibPos[1] = readcoord();
|
|
||||||
vGibPos[2] = readcoord();
|
|
||||||
vector vDir = g_vec_null;
|
|
||||||
vDir[0] = readcoord();
|
|
||||||
vDir[1] = readcoord();
|
|
||||||
vDir[2] = readcoord();
|
|
||||||
float flForce = readfloat();
|
|
||||||
FX_GibHuman(vGibPos, vDir, flForce);
|
|
||||||
break;
|
|
||||||
case EV_GIBALIEN:
|
|
||||||
vector vGibPos2 = g_vec_null;
|
|
||||||
vGibPos[0] = readcoord();
|
|
||||||
vGibPos[1] = readcoord();
|
|
||||||
vGibPos[2] = readcoord();
|
|
||||||
vector vDir2 = g_vec_null;
|
|
||||||
vDir[0] = readcoord();
|
|
||||||
vDir[1] = readcoord();
|
|
||||||
vDir[2] = readcoord();
|
|
||||||
float flForce2 = readfloat();
|
|
||||||
FX_GibAlien(vGibPos2, vDir2, flForce2);
|
|
||||||
break;
|
|
||||||
case EV_BLOOD:
|
case EV_BLOOD:
|
||||||
vector vBloodPos = g_vec_null;
|
vector vBloodPos = g_vec_null;
|
||||||
vector vBloodColor = g_vec_null;
|
vector vBloodColor = g_vec_null;
|
||||||
|
|
|
@ -53,8 +53,6 @@ ClientGame_RendererRestart(string rstr)
|
||||||
FX_Blood_Init();
|
FX_Blood_Init();
|
||||||
FX_BreakModel_Init();
|
FX_BreakModel_Init();
|
||||||
FX_Explosion_Init();
|
FX_Explosion_Init();
|
||||||
FX_GibAlien_Init();
|
|
||||||
FX_GibHuman_Init();
|
|
||||||
FX_Spark_Init();
|
FX_Spark_Init();
|
||||||
FX_Impact_Init();
|
FX_Impact_Init();
|
||||||
FX_GaussBeam_Init();
|
FX_GaussBeam_Init();
|
||||||
|
|
|
@ -128,8 +128,10 @@ HLMultiplayerRules::PlayerDeath(NSClientPlayer pl)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* either gib, or make a corpse */
|
/* either gib, or make a corpse */
|
||||||
if (pl.health < -50) {
|
if (pl.health < 0) {
|
||||||
FX_GibHuman(pl.origin, vectoangles(pl.origin - g_dmg_eAttacker.origin), g_dmg_iDamage * 2.0f);
|
vector gibDir = vectoangles(pl.origin - g_dmg_eAttacker.origin);
|
||||||
|
float gibStrength = g_dmg_iDamage * 2.0f;
|
||||||
|
BreakModel_Entity(pl, gibDir, gibStrength, 8);
|
||||||
} else {
|
} else {
|
||||||
FX_Corpse_Spawn((player)pl, ANIM_DIESIMPLE);
|
FX_Corpse_Spawn((player)pl, ANIM_DIESIMPLE);
|
||||||
}
|
}
|
||||||
|
@ -204,6 +206,7 @@ HLMultiplayerRules::PlayerSpawn(NSClientPlayer pp)
|
||||||
pl.SetInfoKey("*spec", "0");
|
pl.SetInfoKey("*spec", "0");
|
||||||
pl.SetInfoKey("*dead", "0");
|
pl.SetInfoKey("*dead", "0");
|
||||||
pl.SetInfoKey("*deaths", ftos(pl.deaths));
|
pl.SetInfoKey("*deaths", ftos(pl.deaths));
|
||||||
|
pl.SetPropData("actor_human");
|
||||||
|
|
||||||
LevelNewParms();
|
LevelNewParms();
|
||||||
LevelDecodeParms(pl);
|
LevelDecodeParms(pl);
|
||||||
|
|
|
@ -38,7 +38,8 @@ HLSingleplayerRules::PlayerDeath(NSClientPlayer pl)
|
||||||
|
|
||||||
/* so much damage we're gonna gib */
|
/* so much damage we're gonna gib */
|
||||||
if (pl.GetHealth() < -50) {
|
if (pl.GetHealth() < -50) {
|
||||||
FX_GibHuman(pl.origin, vectoangles(pl.origin - g_dmg_eAttacker.origin), g_dmg_iDamage * 2.0f);
|
//pl.Gib();
|
||||||
|
//FX_GibHuman(pl.origin, vectoangles(pl.origin - g_dmg_eAttacker.origin), g_dmg_iDamage * 2.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Let's handle corpses on the clientside */
|
/* Let's handle corpses on the clientside */
|
||||||
|
|
|
@ -1,94 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
|
||||||
* copyright notice and this permission notice appear in all copies.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
|
||||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef CLIENT
|
|
||||||
string g_agibs[] = {
|
|
||||||
"models/agibs.mdl",
|
|
||||||
"models/agibs.mdl",
|
|
||||||
"models/agibs.mdl",
|
|
||||||
"models/agibs.mdl",
|
|
||||||
"models/agibs.mdl"
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
|
||||||
FX_GibAlien_Init(void)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < g_agibs.length; i++)
|
|
||||||
precache_model(g_agibs[i]);
|
|
||||||
|
|
||||||
precache_sound("common/bodysplat.wav");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
|
||||||
FX_GibAlien(vector vecOrigin, vector vecDir, float flForce)
|
|
||||||
{
|
|
||||||
#ifdef SERVER
|
|
||||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
|
||||||
WriteByte(MSG_MULTICAST, EV_GIBALIEN);
|
|
||||||
WriteCoord(MSG_MULTICAST, vecOrigin[0]);
|
|
||||||
WriteCoord(MSG_MULTICAST, vecOrigin[1]);
|
|
||||||
WriteCoord(MSG_MULTICAST, vecOrigin[2]);
|
|
||||||
WriteCoord(MSG_MULTICAST, vecDir[0]);
|
|
||||||
WriteCoord(MSG_MULTICAST, vecDir[1]);
|
|
||||||
WriteCoord(MSG_MULTICAST, vecDir[2]);
|
|
||||||
WriteFloat(MSG_MULTICAST, flForce);
|
|
||||||
msg_entity = __NULL__;
|
|
||||||
multicast(vecOrigin, MULTICAST_PVS);
|
|
||||||
#else
|
|
||||||
static void Gib_Remove(void) {
|
|
||||||
remove(self);
|
|
||||||
}
|
|
||||||
static void Gib_Touch(void)
|
|
||||||
{
|
|
||||||
if (serverkeyfloat("*bspversion") == BSPVER_HL)
|
|
||||||
Decals_Place(self.origin, sprintf("{yblood%d", floor(random(1,7))));
|
|
||||||
else {
|
|
||||||
decal_pickwall(self, self.origin);
|
|
||||||
pointparticles(DECAL_BLOOD, g_tracedDecal.endpos, g_tracedDecal.normal, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cvar("violence_agibs") <= 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
makevectors(vecDir);
|
|
||||||
vecDir = v_forward;
|
|
||||||
|
|
||||||
for (int i = 0; i < 5; i++) {
|
|
||||||
vector vel = vecDir;
|
|
||||||
vel += random(-1,1) * v_right;
|
|
||||||
vel += random(-1,1) * v_up;
|
|
||||||
vel *= flForce;
|
|
||||||
vel += [0,0,80];
|
|
||||||
|
|
||||||
entity gibb = spawn();
|
|
||||||
setmodel(gibb, g_agibs[i]);
|
|
||||||
setorigin(gibb, vecOrigin);
|
|
||||||
gibb.movetype = MOVETYPE_BOUNCE;
|
|
||||||
gibb.solid = SOLID_BBOX;
|
|
||||||
setsize(gibb, [0,0,0], [0,0,0]);
|
|
||||||
gibb.velocity = vel;
|
|
||||||
gibb.avelocity = vectoangles(gibb.velocity);
|
|
||||||
gibb.think = Gib_Remove;
|
|
||||||
gibb.touch = Gib_Touch;
|
|
||||||
gibb.nextthink = time + 5.0f;
|
|
||||||
gibb.drawmask = MASK_ENGINE;
|
|
||||||
}
|
|
||||||
pointsound(vecOrigin, "common/bodysplat.wav", 1, ATTN_NORM);
|
|
||||||
#endif
|
|
||||||
}
|
|
|
@ -1,94 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (c) 2016-2020 Marco Cawthorne <marco@icculus.org>
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
|
||||||
* copyright notice and this permission notice appear in all copies.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
|
||||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef CLIENT
|
|
||||||
string g_hgibs[] = {
|
|
||||||
"models/gib_b_bone.mdl",
|
|
||||||
"models/gib_legbone.mdl",
|
|
||||||
"models/gib_lung.mdl",
|
|
||||||
"models/gib_skull.mdl",
|
|
||||||
"models/gib_b_gib.mdl"
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
|
||||||
FX_GibHuman_Init(void)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < g_hgibs.length; i++)
|
|
||||||
precache_model(g_hgibs[i]);
|
|
||||||
|
|
||||||
precache_sound("common/bodysplat.wav");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
|
||||||
FX_GibHuman(vector vecOrigin, vector vecDir, float flForce)
|
|
||||||
{
|
|
||||||
#ifdef SERVER
|
|
||||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
|
||||||
WriteByte(MSG_MULTICAST, EV_GIBHUMAN);
|
|
||||||
WriteCoord(MSG_MULTICAST, vecOrigin[0]);
|
|
||||||
WriteCoord(MSG_MULTICAST, vecOrigin[1]);
|
|
||||||
WriteCoord(MSG_MULTICAST, vecOrigin[2]);
|
|
||||||
WriteCoord(MSG_MULTICAST, vecDir[0]);
|
|
||||||
WriteCoord(MSG_MULTICAST, vecDir[1]);
|
|
||||||
WriteCoord(MSG_MULTICAST, vecDir[2]);
|
|
||||||
WriteFloat(MSG_MULTICAST, flForce);
|
|
||||||
msg_entity = __NULL__;
|
|
||||||
multicast(vecOrigin, MULTICAST_PVS);
|
|
||||||
#else
|
|
||||||
static void Gib_Remove(void) {
|
|
||||||
remove(self);
|
|
||||||
}
|
|
||||||
static void Gib_Touch(void)
|
|
||||||
{
|
|
||||||
if (serverkeyfloat("*bspversion") == BSPVER_HL)
|
|
||||||
Decals_Place(self.origin, sprintf("{blood%d", floor(random(1,9))));
|
|
||||||
else {
|
|
||||||
decal_pickwall(self, self.origin);
|
|
||||||
pointparticles(DECAL_BLOOD, g_tracedDecal.endpos, g_tracedDecal.normal, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cvar("violence_hgibs") <= 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
makevectors(vecDir);
|
|
||||||
vecDir = v_forward;
|
|
||||||
|
|
||||||
for (int i = 0; i < 5; i++) {
|
|
||||||
vector vel = vecDir;
|
|
||||||
vel += random(-1,1) * v_right;
|
|
||||||
vel += random(-1,1) * v_up;
|
|
||||||
vel *= flForce;
|
|
||||||
vel += [0,0,80];
|
|
||||||
|
|
||||||
entity gibb = spawn();
|
|
||||||
setmodel(gibb, g_hgibs[i]);
|
|
||||||
setorigin(gibb, vecOrigin);
|
|
||||||
gibb.movetype = MOVETYPE_BOUNCE;
|
|
||||||
gibb.solid = SOLID_BBOX;
|
|
||||||
setsize(gibb, [0,0,0], [0,0,0]);
|
|
||||||
gibb.velocity = vel;
|
|
||||||
gibb.avelocity = vectoangles(gibb.velocity);
|
|
||||||
gibb.think = Gib_Remove;
|
|
||||||
gibb.touch = Gib_Touch;
|
|
||||||
gibb.nextthink = time + 5.0f;
|
|
||||||
gibb.drawmask = MASK_ENGINE;
|
|
||||||
}
|
|
||||||
pointsound(vecOrigin, "common/bodysplat.wav", 1, ATTN_NORM);
|
|
||||||
#endif
|
|
||||||
}
|
|
|
@ -12,8 +12,6 @@ fx_blood.qc
|
||||||
fx_gaussbeam.qc
|
fx_gaussbeam.qc
|
||||||
fx_breakmodel.qc
|
fx_breakmodel.qc
|
||||||
fx_explosion.qc
|
fx_explosion.qc
|
||||||
fx_gibalien.qc
|
|
||||||
fx_gibhuman.qc
|
|
||||||
fx_spark.qc
|
fx_spark.qc
|
||||||
fx_corpse.qc
|
fx_corpse.qc
|
||||||
fx_impact.qc
|
fx_impact.qc
|
||||||
|
|
|
@ -39,10 +39,12 @@
|
||||||
"actor_alien"
|
"actor_alien"
|
||||||
{
|
{
|
||||||
"breakable_model" "gibs_alien"
|
"breakable_model" "gibs_alien"
|
||||||
|
"breakable_count" "4"
|
||||||
}
|
}
|
||||||
"actor_human"
|
"actor_human"
|
||||||
{
|
{
|
||||||
"breakable_model" "gibs_human"
|
"breakable_model" "gibs_human"
|
||||||
|
"breakable_count" "6"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue