From e9fc8c1358ea3948639e7d43178b338d9a473979 Mon Sep 17 00:00:00 2001 From: TimePath Date: Sun, 12 Jun 2016 14:01:13 +1000 Subject: [PATCH] Fix invisible devastator rockets --- .../mutators/mutator/physical_items/physical_items.qc | 2 +- qcsrc/common/t_items.qc | 2 +- qcsrc/common/vehicles/vehicle/racer.qc | 2 +- qcsrc/common/weapons/weapon/devastator.qc | 7 ++----- qcsrc/lib/csqcmodel/sv_model.qc | 3 +-- qcsrc/lib/net.qh | 5 +---- qcsrc/lib/self.qh | 2 ++ qcsrc/server/g_subs.qc | 2 +- qcsrc/server/weapons/csqcprojectile.qc | 6 +++--- 9 files changed, 13 insertions(+), 18 deletions(-) diff --git a/qcsrc/common/mutators/mutator/physical_items/physical_items.qc b/qcsrc/common/mutators/mutator/physical_items/physical_items.qc index fed70ef7d..7bd1687af 100644 --- a/qcsrc/common/mutators/mutator/physical_items/physical_items.qc +++ b/qcsrc/common/mutators/mutator/physical_items/physical_items.qc @@ -136,6 +136,6 @@ MUTATOR_HOOKFUNCTION(physical_items, Item_Spawn) item.effects |= EF_NODRAW; // hide the original weapon item.movetype = MOVETYPE_FOLLOW; item.aiment = wep; // attach the original weapon - item.SendEntity3 = func_null; + setSendEntity(item, func_null); } #endif diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index 0829464d2..06c2f064f 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -356,7 +356,7 @@ void ItemUpdate(entity this) void UpdateItemAfterTeleport(entity this) { - if(this.SendEntity3 == ItemSend) + if(getSendEntity(this) == ItemSend) ItemUpdate(this); } diff --git a/qcsrc/common/vehicles/vehicle/racer.qc b/qcsrc/common/vehicles/vehicle/racer.qc index ba3d02577..e85e868a6 100644 --- a/qcsrc/common/vehicles/vehicle/racer.qc +++ b/qcsrc/common/vehicles/vehicle/racer.qc @@ -625,7 +625,7 @@ METHOD(Racer, vr_spawn, void(Racer thisveh, entity instance)) METHOD(Racer, vr_death, void(Racer thisveh, entity instance)) { #ifdef SVQC - instance.SendEntity = func_null; // stop networking this racer (for now) + setSendEntity(instance, func_null); // stop networking this racer (for now) instance.health = 0; instance.event_damage = func_null; instance.solid = SOLID_CORPSE; diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index fe3a19a0b..bc4b609bf 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -349,15 +349,12 @@ void W_Devastator_Damage(entity this, entity inflictor, entity attacker, float d void W_Devastator_Attack(Weapon thiswep, entity actor) { - entity missile; - entity flash; - W_DecreaseAmmo(thiswep, actor, WEP_CVAR(devastator, ammo)); W_SetupShot_ProjectileSize(actor, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR(devastator, damage)); Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1); - missile = WarpZone_RefSys_SpawnSameRefSys(actor); + entity missile = WarpZone_RefSys_SpawnSameRefSys(actor); missile.owner = missile.realowner = actor; actor.lastrocket = missile; if(WEP_CVAR(devastator, detonatedelay) >= 0) @@ -394,7 +391,7 @@ void W_Devastator_Attack(Weapon thiswep, entity actor) CSQCProjectile(missile, WEP_CVAR(devastator, guiderate) == 0 && WEP_CVAR(devastator, speedaccel) == 0, PROJECTILE_ROCKET, false); // because of fly sound // muzzle flash for 1st person view - flash = spawn(); + entity flash = spawn(); setmodel(flash, MDL_DEVASTATOR_MUZZLEFLASH); // precision set below SUB_SetFade(flash, time, 0.1); flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION; diff --git a/qcsrc/lib/csqcmodel/sv_model.qc b/qcsrc/lib/csqcmodel/sv_model.qc index 2d0e5eb09..d495ae015 100644 --- a/qcsrc/lib/csqcmodel/sv_model.qc +++ b/qcsrc/lib/csqcmodel/sv_model.qc @@ -128,6 +128,5 @@ void CSQCModel_LinkEntity(entity e) void CSQCModel_UnlinkEntity(entity e) { - e.SendEntity = func_null; - e.SendEntity3 = func_null; + setSendEntity(e, func_null); } diff --git a/qcsrc/lib/net.qh b/qcsrc/lib/net.qh index 507807919..4e09d4b01 100644 --- a/qcsrc/lib/net.qh +++ b/qcsrc/lib/net.qh @@ -97,9 +97,6 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); } .int Version; // deprecated, use SendFlags .int SendFlags; - .bool(entity to, int sendflags) SendEntity; - /** return false to remove from the client */ - .bool(entity this, entity to, int sendflags) SendEntity3; void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc) { @@ -127,7 +124,7 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); } void Net_UnlinkEntity(entity e) { - e.SendEntity = func_null; + setSendEntity(e, func_null); } .void(entity this) uncustomizeentityforclient; diff --git a/qcsrc/lib/self.qh b/qcsrc/lib/self.qh index 37f0c50d2..ec43a3402 100644 --- a/qcsrc/lib/self.qh +++ b/qcsrc/lib/self.qh @@ -84,8 +84,10 @@ SELFWRAP(customizeentityforclient, bool, (), (entity this), (this)) SELFWRAP(camera_transform, vector, (vector org, vector ang), (entity this, vector org, vector ang), (this, org, ang)) #define setcamera_transform(e, f) SELFWRAP_SET(camera_transform, e, f) +/** return false to remove from the client */ SELFWRAP(SendEntity, bool, (entity to, int sendflags), (entity this, entity to, int sendflags), (this, to, sendflags)) #define setSendEntity(e, f) SELFWRAP_SET(SendEntity, e, f) +#define getSendEntity(e) SELFWRAP_GET(SendEntity, e) #define ChangeYaw(e, ...) (__self = (e), builtin_ChangeYaw(__VA_ARGS__)) #define checkclient(e, ...) (__self = (e), builtin_checkclient(__VA_ARGS__)) diff --git a/qcsrc/server/g_subs.qc b/qcsrc/server/g_subs.qc index d4463f693..e2b7ba269 100644 --- a/qcsrc/server/g_subs.qc +++ b/qcsrc/server/g_subs.qc @@ -321,7 +321,7 @@ void LODmodel_attach(entity this) } if(this.lodmodelindex1) - if (!this.SendEntity) + if (!getSendEntity(this)) SetCustomizer(this, LOD_customize, LOD_uncustomize); } diff --git a/qcsrc/server/weapons/csqcprojectile.qc b/qcsrc/server/weapons/csqcprojectile.qc index 0edf22664..7e7478e9b 100644 --- a/qcsrc/server/weapons/csqcprojectile.qc +++ b/qcsrc/server/weapons/csqcprojectile.qc @@ -98,13 +98,13 @@ void CSQCProjectile(entity e, float clientanimate, int type, float docull) void UpdateCSQCProjectile(entity e) { - if(e.SendEntity3 == CSQCProjectile_SendEntity) + if(getSendEntity(e) == CSQCProjectile_SendEntity) { // send new origin data e.SendFlags |= 0x01; } // FIXME HACK - else if(e.SendEntity3 == ItemSend) + else if(getSendEntity(e) == ItemSend) { ItemUpdate(e); } @@ -113,7 +113,7 @@ void UpdateCSQCProjectile(entity e) void UpdateCSQCProjectileAfterTeleport(entity e) { - if(e.SendEntity3 == CSQCProjectile_SendEntity) + if(getSendEntity(e) == CSQCProjectile_SendEntity) { // send new origin data e.SendFlags |= 0x01; -- 2.39.2