From 24964d27c97b4f91e8cbd8526946493d5ba01c8c Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Mon, 17 Jul 2023 11:32:59 -0700 Subject: [PATCH] Get rid of FX_GibHuman and FX_GibAlien, use PropData system instead --- src/client/game_event.qc | 24 ------- src/client/init.qc | 2 - src/server/gamerules_multiplayer.qc | 7 ++- src/server/gamerules_singleplayer.qc | 3 +- src/shared/fx_gibalien.qc | 94 ---------------------------- src/shared/fx_gibhuman.qc | 94 ---------------------------- src/shared/include.src | 2 - zpak001.pk3dir/scripts/propdata.txt | 2 + 8 files changed, 9 insertions(+), 219 deletions(-) delete mode 100644 src/shared/fx_gibalien.qc delete mode 100644 src/shared/fx_gibhuman.qc diff --git a/src/client/game_event.qc b/src/client/game_event.qc index 38d1204..06415e8 100644 --- a/src/client/game_event.qc +++ b/src/client/game_event.qc @@ -34,30 +34,6 @@ ClientGame_EventParse(float fHeader) vSparkAngle[2] = readcoord(); FX_Spark(vSparkPos, vSparkAngle); 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: vector vBloodPos = g_vec_null; vector vBloodColor = g_vec_null; diff --git a/src/client/init.qc b/src/client/init.qc index 45b105c..e1eb11a 100644 --- a/src/client/init.qc +++ b/src/client/init.qc @@ -53,8 +53,6 @@ ClientGame_RendererRestart(string rstr) FX_Blood_Init(); FX_BreakModel_Init(); FX_Explosion_Init(); - FX_GibAlien_Init(); - FX_GibHuman_Init(); FX_Spark_Init(); FX_Impact_Init(); FX_GaussBeam_Init(); diff --git a/src/server/gamerules_multiplayer.qc b/src/server/gamerules_multiplayer.qc index 44d158f..b929027 100644 --- a/src/server/gamerules_multiplayer.qc +++ b/src/server/gamerules_multiplayer.qc @@ -128,8 +128,10 @@ HLMultiplayerRules::PlayerDeath(NSClientPlayer pl) #endif /* either gib, or make a corpse */ - if (pl.health < -50) { - FX_GibHuman(pl.origin, vectoangles(pl.origin - g_dmg_eAttacker.origin), g_dmg_iDamage * 2.0f); + if (pl.health < 0) { + vector gibDir = vectoangles(pl.origin - g_dmg_eAttacker.origin); + float gibStrength = g_dmg_iDamage * 2.0f; + BreakModel_Entity(pl, gibDir, gibStrength, 8); } else { FX_Corpse_Spawn((player)pl, ANIM_DIESIMPLE); } @@ -204,6 +206,7 @@ HLMultiplayerRules::PlayerSpawn(NSClientPlayer pp) pl.SetInfoKey("*spec", "0"); pl.SetInfoKey("*dead", "0"); pl.SetInfoKey("*deaths", ftos(pl.deaths)); + pl.SetPropData("actor_human"); LevelNewParms(); LevelDecodeParms(pl); diff --git a/src/server/gamerules_singleplayer.qc b/src/server/gamerules_singleplayer.qc index 13c3880..531e4fd 100644 --- a/src/server/gamerules_singleplayer.qc +++ b/src/server/gamerules_singleplayer.qc @@ -38,7 +38,8 @@ HLSingleplayerRules::PlayerDeath(NSClientPlayer pl) /* so much damage we're gonna gib */ 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 */ diff --git a/src/shared/fx_gibalien.qc b/src/shared/fx_gibalien.qc deleted file mode 100644 index c9cb041..0000000 --- a/src/shared/fx_gibalien.qc +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2016-2020 Marco Cawthorne - * - * 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 -} diff --git a/src/shared/fx_gibhuman.qc b/src/shared/fx_gibhuman.qc deleted file mode 100644 index c6c9062..0000000 --- a/src/shared/fx_gibhuman.qc +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2016-2020 Marco Cawthorne - * - * 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 -} diff --git a/src/shared/include.src b/src/shared/include.src index 6b42b48..6fc8b2f 100644 --- a/src/shared/include.src +++ b/src/shared/include.src @@ -12,8 +12,6 @@ fx_blood.qc fx_gaussbeam.qc fx_breakmodel.qc fx_explosion.qc -fx_gibalien.qc -fx_gibhuman.qc fx_spark.qc fx_corpse.qc fx_impact.qc diff --git a/zpak001.pk3dir/scripts/propdata.txt b/zpak001.pk3dir/scripts/propdata.txt index 9965cf9..801c42b 100644 --- a/zpak001.pk3dir/scripts/propdata.txt +++ b/zpak001.pk3dir/scripts/propdata.txt @@ -39,10 +39,12 @@ "actor_alien" { "breakable_model" "gibs_alien" + "breakable_count" "4" } "actor_human" { "breakable_model" "gibs_human" + "breakable_count" "6" }