From f27a9c3e1be558b4b6211e6565e8b68f7a1ffd1c Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 24 Aug 2015 12:26:11 +1000 Subject: [PATCH] Add a few more mutator hooks to handle custom projectiles --- qcsrc/client/mutators/events.qh | 15 +++++++++++++++ qcsrc/client/weapons/projectile.qc | 6 ++++++ qcsrc/common/constants.qh | 2 ++ 3 files changed, 23 insertions(+) diff --git a/qcsrc/client/mutators/events.qh b/qcsrc/client/mutators/events.qh index 8f317c8e8..893765a7e 100644 --- a/qcsrc/client/mutators/events.qh +++ b/qcsrc/client/mutators/events.qh @@ -49,4 +49,19 @@ MUTATOR_HOOKABLE(UpdateCrosshair, EV_NO_ARGS); /**/ MUTATOR_HOOKABLE(CSQC_Parse_TempEntity, EV_CSQC_Parse_TempEntity); +/** Called when a projectile is linked with CSQC */ +#define EV_Ent_Projectile(i, o) \ + /** entity id */ i(entity, self) \ + /**/ +MUTATOR_HOOKABLE(Ent_Projectile, EV_Ent_Projectile); + +/** Called when a projectile's properties are being modified */ +#define EV_EditProjectile(i, o) \ + /** entity id */ i(entity, self) \ + /**/ +MUTATOR_HOOKABLE(EditProjectile, EV_EditProjectile); + +/* Called when projectiles are precached */ +MUTATOR_HOOKABLE(PrecacheProjectiles, EV_NO_ARGS); + #endif diff --git a/qcsrc/client/weapons/projectile.qc b/qcsrc/client/weapons/projectile.qc index 4e1544be8..1d0083e28 100644 --- a/qcsrc/client/weapons/projectile.qc +++ b/qcsrc/client/weapons/projectile.qc @@ -318,6 +318,9 @@ void Ent_Projectile() case PROJECTILE_RPC: setmodel(self, "models/weapons/ok_rocket.md3");self.traileffect = particleeffectnum("TR_ROCKET"); break; default: + if(MUTATOR_CALLHOOK(Ent_Projectile, self)) + break; + if (Nade_FromProjectile(self.cnt) != NADE_TYPE_NULL) { setmodel(self, "models/weapons/v_ok_grenade.md3"); @@ -470,6 +473,8 @@ void Ent_Projectile() self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY; } + MUTATOR_CALLHOOK(EditProjectile, self); + setsize(self, self.mins, self.maxs); } @@ -520,4 +525,5 @@ void Projectile_Precache() precache_sound("weapons/fireball_fly2.wav"); precache_sound("weapons/tag_rocket_fly.wav"); + MUTATOR_CALLHOOK(PrecacheProjectiles); } diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index 231046d6d..1e77197f6 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -296,6 +296,8 @@ const int PROJECTILE_BUMBLE_BEAM = 31; const int PROJECTILE_MAGE_SPIKE = 32; const int PROJECTILE_SHAMBLER_LIGHTNING = 33; +// projectile IDs 40-50 reserved + const int PROJECTILE_RPC = 60; const int SPECIES_HUMAN = 0; -- 2.39.2