Extend FX_GibHuman with a dir (euler) and force parameter.
This commit is contained in:
parent
fdd706526f
commit
4cda2628e6
9 changed files with 32 additions and 19 deletions
|
@ -36,7 +36,12 @@ ClientGame_EventParse(float fHeader)
|
|||
vGibPos[0] = readcoord();
|
||||
vGibPos[1] = readcoord();
|
||||
vGibPos[2] = readcoord();
|
||||
FX_GibHuman(vGibPos);
|
||||
vector vDir;
|
||||
vDir[0] = readcoord();
|
||||
vDir[1] = readcoord();
|
||||
vDir[2] = readcoord();
|
||||
float flForce = readfloat();
|
||||
FX_GibHuman(vGibPos, vDir, flForce);
|
||||
break;
|
||||
case EV_BLOOD:
|
||||
vector vBloodPos;
|
||||
|
|
|
@ -71,7 +71,7 @@ HLMultiplayerRules::PlayerDeath(base_player pl)
|
|||
|
||||
/* either gib, or make a corpse */
|
||||
if (pl.health < -50) {
|
||||
FX_GibHuman(pl.origin);
|
||||
FX_GibHuman(pl.origin, vectoangles(pl.origin - g_dmg_eAttacker.origin), g_dmg_iDamage * 2.0f);
|
||||
} else {
|
||||
FX_Corpse_Spawn((player)pl, ANIM_DIESIMPLE);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ HLSingleplayerRules::PlayerDeath(base_player pl)
|
|||
}
|
||||
|
||||
if (pl.health < -50) {
|
||||
FX_GibHuman(pl.origin);
|
||||
FX_GibHuman(pl.origin, vectoangles(pl.origin - g_dmg_eAttacker.origin), g_dmg_iDamage * 2.0f);
|
||||
}
|
||||
|
||||
/* Let's handle corpses on the clientside */
|
||||
|
|
|
@ -37,7 +37,7 @@ void
|
|||
monster_barney_dead::Gib(void)
|
||||
{
|
||||
takedamage = DAMAGE_NO;
|
||||
FX_GibHuman(this.origin);
|
||||
FX_GibHuman(origin, vectoangles(origin - g_dmg_eAttacker.origin), g_dmg_iDamage * 2.0f);
|
||||
Hide();
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ void
|
|||
monster_hevsuit_dead::Gib(void)
|
||||
{
|
||||
takedamage = DAMAGE_NO;
|
||||
FX_GibHuman(this.origin);
|
||||
FX_GibHuman(origin, vectoangles(origin - g_dmg_eAttacker.origin), g_dmg_iDamage * 2.0f);
|
||||
Hide();
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ void
|
|||
monster_hgrunt_dead::Gib(void)
|
||||
{
|
||||
takedamage = DAMAGE_NO;
|
||||
FX_GibHuman(this.origin);
|
||||
FX_GibHuman(origin, vectoangles(origin - g_dmg_eAttacker.origin), g_dmg_iDamage * 2.0f);
|
||||
Hide();
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ void
|
|||
monster_scientist_dead::Gib(void)
|
||||
{
|
||||
takedamage = DAMAGE_NO;
|
||||
FX_GibHuman(this.origin);
|
||||
FX_GibHuman(origin, vectoangles(origin - g_dmg_eAttacker.origin), g_dmg_iDamage * 2.0f);
|
||||
Hide();
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ void
|
|||
monster_sitting_scientist::Gib(void)
|
||||
{
|
||||
takedamage = DAMAGE_NO;
|
||||
FX_GibHuman(this.origin);
|
||||
FX_GibHuman(origin, vectoangles(origin - g_dmg_eAttacker.origin), g_dmg_iDamage * 2.0f);
|
||||
Hide();
|
||||
}
|
||||
|
||||
|
|
|
@ -36,16 +36,20 @@ FX_GibHuman_Init(void)
|
|||
#endif
|
||||
|
||||
void
|
||||
FX_GibHuman(vector pos)
|
||||
FX_GibHuman(vector vecOrigin, vector vecDir, float flForce)
|
||||
{
|
||||
#ifdef SERVER
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_GIBHUMAN);
|
||||
WriteCoord(MSG_MULTICAST, pos[0]);
|
||||
WriteCoord(MSG_MULTICAST, pos[1]);
|
||||
WriteCoord(MSG_MULTICAST, pos[2]);
|
||||
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(pos, MULTICAST_PVS);
|
||||
multicast(vecOrigin, MULTICAST_PVS);
|
||||
#else
|
||||
static void Gib_Remove(void) {
|
||||
remove(self);
|
||||
|
@ -64,15 +68,19 @@ FX_GibHuman(vector pos)
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
makevectors(vecDir);
|
||||
vecDir = v_forward;
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
vector vel;
|
||||
vel[0] = random(-128,128);
|
||||
vel[1] = random(-128,128);
|
||||
vel[2] = (300 + random() * 64);
|
||||
vector vel = vecDir;
|
||||
vel += random(-1,1) * v_right;
|
||||
vel += random(-1,1) * v_up;
|
||||
vel *= flForce + [0,0,80];
|
||||
|
||||
entity gibb = spawn();
|
||||
setmodel(gibb, g_hgibs[i]);
|
||||
setorigin(gibb, pos);
|
||||
setorigin(gibb, vecOrigin);
|
||||
gibb.movetype = MOVETYPE_BOUNCE;
|
||||
gibb.solid = SOLID_BBOX;
|
||||
setsize(gibb, [0,0,0], [0,0,0]);
|
||||
|
@ -83,6 +91,6 @@ FX_GibHuman(vector pos)
|
|||
gibb.nextthink = time + 5.0f;
|
||||
gibb.drawmask = MASK_ENGINE;
|
||||
}
|
||||
pointsound(pos, "common/bodysplat.wav", 1, ATTN_NORM);
|
||||
pointsound(vecOrigin, "common/bodysplat.wav", 1, ATTN_NORM);
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue