]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
tuba: fix #1621
authorTimePath <andrew.hardaker1995@gmail.com>
Thu, 24 Dec 2015 10:45:24 +0000 (21:45 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Thu, 24 Dec 2015 10:45:24 +0000 (21:45 +1100)
23 files changed:
qcsrc/common/mutators/mutator/overkill/hmg.qc
qcsrc/common/mutators/mutator/overkill/rpc.qc
qcsrc/common/stats.qh
qcsrc/common/weapons/weapon.qh
qcsrc/common/weapons/weapon/crylink.qc
qcsrc/common/weapons/weapon/devastator.qc
qcsrc/common/weapons/weapon/electro.qc
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/common/weapons/weapon/hlac.qc
qcsrc/common/weapons/weapon/machinegun.qc
qcsrc/common/weapons/weapon/minelayer.qc
qcsrc/common/weapons/weapon/mortar.qc
qcsrc/common/weapons/weapon/rifle.qc
qcsrc/common/weapons/weapon/seeker.qc
qcsrc/common/weapons/weapon/shotgun.qc
qcsrc/common/weapons/weapon/tuba.qc
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/common/weapons/weapon/vortex.qc
qcsrc/lib/net.qh
qcsrc/server/cl_client.qh
qcsrc/server/cl_impulse.qc
qcsrc/server/race.qc
qcsrc/server/weapons/selection.qc

index 28b1715e18cd23e348753815ff26e960821716c7..6da57cb82bcc1decc0d61cb661fb0c3c7f13f8d1 100644 (file)
@@ -108,7 +108,7 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weapone
                METHOD(HeavyMachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
                {
                        if(WEP_CVAR(hmg, reload_ammo) && actor.clip_load < WEP_CVAR(hmg, ammo)) { // forced reload
-                               thiswep.wr_reload(thiswep);
+                               thiswep.wr_reload(thiswep, actor, weaponentity);
                        } else
                        {
                                if (fire & 1)
@@ -137,7 +137,7 @@ void W_HeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weapone
 
                        return ammo_amount;
                }
-               METHOD(HeavyMachineGun, wr_reload, void(entity thiswep))
+               METHOD(HeavyMachineGun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
                {
                        W_Reload(self, WEP_CVAR(hmg, ammo), SND(RELOAD));
                }
index 638873d341bae18451655bb4532dd24e49ecace0..fb7ff8c692102564d84a1421ff4457689f7f76f0 100644 (file)
@@ -157,7 +157,7 @@ void W_RocketPropelledChainsaw_Attack (Weapon thiswep)
                METHOD(RocketPropelledChainsaw, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
                {
                        if(WEP_CVAR(rpc, reload_ammo) && actor.clip_load < WEP_CVAR(rpc, ammo)) {
-                               thiswep.wr_reload(thiswep);
+                               thiswep.wr_reload(thiswep, actor, weaponentity);
                        } else
                        {
                                if (fire & 1)
@@ -185,7 +185,7 @@ void W_RocketPropelledChainsaw_Attack (Weapon thiswep)
                {
                        return false;
                }
-               METHOD(RocketPropelledChainsaw, wr_reload, void(entity thiswep))
+               METHOD(RocketPropelledChainsaw, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
                {
                        W_Reload(self, WEP_CVAR(rpc, ammo), SND(RELOAD));
                }
index 4409e70ced1381c4709dae3ac49a024dec3cec65..7c29df469bdfce1e4a7596bbff0b642df4e9a782 100644 (file)
@@ -62,7 +62,7 @@ REGISTER_STAT(SWITCHWEAPON, int)
 REGISTER_STAT(SWITCHINGWEAPON, int)
 REGISTER_STAT(WEAPON_NEXTTHINK, float)
 #ifdef SVQC
-SPECTATE_COPY(_STAT(WEAPON_NEXTTHINK))
+SPECTATE_COPYFIELD(_STAT(WEAPON_NEXTTHINK))
 float W_WeaponRateFactor();
 #endif
 REGISTER_STAT(WEAPONRATEFACTOR, float, W_WeaponRateFactor())
@@ -303,7 +303,7 @@ REPLICATE(cvar_cl_gunalign, int, "cl_gunalign");
 #endif
 REGISTER_STAT(GUNALIGN, int, this.cvar_cl_gunalign)
 #ifdef SVQC
-SPECTATE_COPY(_STAT(GUNALIGN))
+SPECTATE_COPYFIELD(_STAT(GUNALIGN))
 #endif
 
 
index ccb71154e5b3dd95d7d7a162dff8784b12880d68..b529d109d4ccf7861ea9ee569a5844d45bce1ec4 100644 (file)
@@ -97,7 +97,7 @@ CLASS(Weapon, Object)
     /** (SERVER) notification number for kill message (may inspect w_deathtype for details) */
     METHOD(Weapon, wr_killmessage, int(Weapon this)) {return 0;}
     /** (SERVER) handles reloading for weapon */
-    METHOD(Weapon, wr_reload, void(Weapon this)) {}
+    METHOD(Weapon, wr_reload, void(Weapon this, entity actor, .entity weaponentity)) {}
     /** (SERVER) clears fields that the weapon may use */
     METHOD(Weapon, wr_resetplayer, void(Weapon this)) {}
     /** (CLIENT) impact effect for weapon explosion */
index 7ef7cf64dfb0d26fe2d9fec069494821576548a7..ba1e9b0fe76f34ed9c71de1c119e1467a40f2478 100644 (file)
@@ -578,7 +578,7 @@ void W_Crylink_Attack2(Weapon thiswep)
                METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
                {
                        if(autocvar_g_balance_crylink_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep);
+                               thiswep.wr_reload(thiswep, actor, weaponentity);
                        }
 
                        if(fire & 1)
@@ -653,7 +653,7 @@ void W_Crylink_Attack2(Weapon thiswep)
                        ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_SEC(crylink, ammo);
                        return ammo_amount;
                }
-               METHOD(Crylink, wr_reload, void(entity thiswep))
+               METHOD(Crylink, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
                {
                        W_Reload(self, min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), SND(RELOAD));
                }
index 6aff9a2f3ea0842cd8d1229dd83afa5cb2273054..69e925d112e2515c580546aa106da8a4dbcd26c4 100644 (file)
@@ -531,7 +531,7 @@ void W_Devastator_Attack(Weapon thiswep)
                METHOD(Devastator, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
                {
                        if(WEP_CVAR(devastator, reload_ammo) && actor.clip_load < WEP_CVAR(devastator, ammo)) { // forced reload
-                               thiswep.wr_reload(thiswep);
+                               thiswep.wr_reload(thiswep, actor, weaponentity);
                        } else {
                                if(fire & 1)
                                {
@@ -613,7 +613,7 @@ void W_Devastator_Attack(Weapon thiswep)
                        self.lastrocket = NULL; // stop rocket guiding, no revenge from the grave!
                        self.rl_release = 0;
                }
-               METHOD(Devastator, wr_reload, void(entity thiswep))
+               METHOD(Devastator, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
                {
                        W_Reload(self, WEP_CVAR(devastator, ammo), SND(RELOAD));
                }
index 44c5cf80d1f0ec9b9c582a865262ee48878baa05..a72ff3927c82a6087d64d2ad9b5d28baa3d8b8dc 100644 (file)
@@ -465,7 +465,7 @@ void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, i
 
                                if(!ammo_amount)
                                {
-                                       thiswep.wr_reload(thiswep);
+                                       thiswep.wr_reload(thiswep, actor, weaponentity);
                                        return;
                                }
                        }
@@ -515,7 +515,7 @@ void W_Electro_CheckAttack(Weapon thiswep, entity actor, .entity weaponentity, i
                {
                        self.electro_secondarytime = time;
                }
-               METHOD(Electro, wr_reload, void(entity thiswep))
+               METHOD(Electro, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
                {
                        W_Reload(self, min(WEP_CVAR_PRI(electro, ammo), WEP_CVAR_SEC(electro, ammo)), SND(RELOAD));
                }
index 292e0361f32faafc86d92b0aa623cb121fd67686..611097e90d02c8cb712dc781869d69ce6c9c8b70 100644 (file)
@@ -412,7 +412,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep, .entity weaponentity)
                        if(loadable_secondary)
                                W_Hagar_Attack2_Load(thiswep, weaponentity); // must always run each frame
                        if(autocvar_g_balance_hagar_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep);
+                               thiswep.wr_reload(thiswep, actor, weaponentity);
                        } else if((fire & 1) && !actor.hagar_load && !actor.hagar_loadblock) // not while secondary is loaded or awaiting reset
                        {
                                if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(hagar, refire)))
@@ -473,7 +473,7 @@ void W_Hagar_Attack2_Load(Weapon thiswep, .entity weaponentity)
                        if(self.hagar_load && WEP_CVAR_SEC(hagar, load_releasedeath))
                                W_Hagar_Attack2_Load_Release(weaponentity);
                }
-               METHOD(Hagar, wr_reload, void(entity thiswep))
+               METHOD(Hagar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
                {
                        if(!self.hagar_load) // require releasing loaded rockets first
                                W_Reload(self, min(WEP_CVAR_PRI(hagar, ammo), WEP_CVAR_SEC(hagar, ammo)), SND(RELOAD));
index 4398386704a0675002482479b9b08ae3bef888e5..3c158f60814e07524c6a483de523d3cfb1997489 100644 (file)
@@ -214,7 +214,7 @@ void W_HLAC_Attack2_Frame(Weapon thiswep)
                METHOD(HLAC, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
                {
                        if(autocvar_g_balance_hlac_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep);
+                               thiswep.wr_reload(thiswep, actor, weaponentity);
                        } else if(fire & 1)
                        {
                                if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(hlac, refire)))
@@ -246,7 +246,7 @@ void W_HLAC_Attack2_Frame(Weapon thiswep)
                        ammo_amount += self.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_SEC(hlac, ammo);
                        return ammo_amount;
                }
-               METHOD(HLAC, wr_reload, void(entity thiswep))
+               METHOD(HLAC, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
                {
                        W_Reload(self, min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), SND(RELOAD));
                }
index beebed977beb03df83bf8934850f2a4b3df3a7e1..c17d07d65f99dc912e0d7004a0d3214869e6924a 100644 (file)
@@ -252,7 +252,7 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentit
                METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
                {
                        if(WEP_CVAR(machinegun, reload_ammo) && actor.clip_load < min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep);
+                               thiswep.wr_reload(thiswep, actor, weaponentity);
                        } else
                        if(WEP_CVAR(machinegun, mode) == 1)
                        {
@@ -334,7 +334,7 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentit
                        }
                        return ammo_amount;
                }
-               METHOD(MachineGun, wr_reload, void(entity thiswep))
+               METHOD(MachineGun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
                {
                        W_Reload(self, min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)), SND(RELOAD));
                }
index ee5660b326e99d402914a2eb58274fb69311c87f..17ef5847ae0cc6990fa50298cf14b22321759163 100644 (file)
@@ -508,7 +508,7 @@ float W_MineLayer_PlacedMines(float detonate)
                        {
                                // not if we're holding the minelayer without enough ammo, but can detonate existing mines
                                if(!(W_MineLayer_PlacedMines(false) && actor.(thiswep.ammo_field) < WEP_CVAR(minelayer, ammo))) {
-                                       thiswep.wr_reload(thiswep);
+                                       thiswep.wr_reload(thiswep, actor, weaponentity);
                                }
                        }
                        else if(fire & 1)
@@ -549,7 +549,7 @@ float W_MineLayer_PlacedMines(float detonate)
                {
                        self.minelayer_mines = 0;
                }
-               METHOD(MineLayer, wr_reload, void(entity thiswep))
+               METHOD(MineLayer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
                {
                        W_Reload(self, WEP_CVAR(minelayer, ammo), SND(RELOAD));
                }
index 3271b2b253cdabba0439c5b1e674f4d829a2ea6b..bac1ef3d587c1ad0aebad257cd0841b5edc09647 100644 (file)
@@ -338,7 +338,7 @@ void W_Mortar_Attack2(Weapon thiswep)
                METHOD(Mortar, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
                {
                        if(autocvar_g_balance_mortar_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep);
+                               thiswep.wr_reload(thiswep, actor, weaponentity);
                        } else if(fire & 1)
                        {
                                if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(mortar, refire)))
@@ -383,7 +383,7 @@ void W_Mortar_Attack2(Weapon thiswep)
                        ammo_amount += self.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_SEC(mortar, ammo);
                        return ammo_amount;
                }
-               METHOD(Mortar, wr_reload, void(entity thiswep))
+               METHOD(Mortar, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
                {
                        W_Reload(self, min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), SND(RELOAD)); // WEAPONTODO
                }
index 97bcac8bb5d7de7833b4ec32409188354bf1cfd9..1f79e59f696bf28a706c6fe930e6ee1d66c6ecd4 100644 (file)
@@ -164,7 +164,7 @@ void W_Rifle_BulletHail(.entity weaponentity, float mode, void() AttackFunc, WFR
                METHOD(Rifle, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
                {
                        if(autocvar_g_balance_rifle_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep);
+                               thiswep.wr_reload(thiswep, actor, weaponentity);
                        } else
                        {
                                actor.rifle_accumulator = bound(time - WEP_CVAR(rifle, bursttime), actor.rifle_accumulator, time);
@@ -181,7 +181,7 @@ void W_Rifle_BulletHail(.entity weaponentity, float mode, void() AttackFunc, WFR
                                        if(WEP_CVAR(rifle, secondary))
                                        {
                                                if(WEP_CVAR_SEC(rifle, reload)) {
-                                                       thiswep.wr_reload(thiswep);
+                                                       thiswep.wr_reload(thiswep, actor, weaponentity);
                                                } else
                                                {
                                                        if(weapon_prepareattack_check(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(rifle, refire)))
@@ -212,7 +212,7 @@ void W_Rifle_BulletHail(.entity weaponentity, float mode, void() AttackFunc, WFR
                {
                        self.rifle_accumulator = time - WEP_CVAR(rifle, bursttime);
                }
-               METHOD(Rifle, wr_reload, void(entity thiswep))
+               METHOD(Rifle, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
                {
                        W_Reload(self, min(WEP_CVAR_PRI(rifle, ammo), WEP_CVAR_SEC(rifle, ammo)), SND(RELOAD));
                }
index 55d6b4f7af125b411a0d6c528ac64890d6eb84cd..911ebb07d0efab4d8d72dad92197b315c02d372a 100644 (file)
@@ -611,7 +611,7 @@ void W_Seeker_Fire_Tag(Weapon thiswep)
                METHOD(Seeker, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
                {
                        if(autocvar_g_balance_seeker_reload_ammo && actor.clip_load < min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep);
+                               thiswep.wr_reload(thiswep, actor, weaponentity);
                        } else if(fire & 1)
                        {
                                if(WEP_CVAR(seeker, type) == 1)
@@ -682,7 +682,7 @@ void W_Seeker_Fire_Tag(Weapon thiswep)
                        }
                        return ammo_amount;
                }
-               METHOD(Seeker, wr_reload, void(entity thiswep))
+               METHOD(Seeker, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
                {
                        W_Reload(self, min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), SND(RELOAD));
                }
index 9bc1a229e45a4469cc768712cf6f7c15f3d6e0e4..8e4570e5aafc3f93025b75b5a209f1410c75ad03 100644 (file)
@@ -240,7 +240,7 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, .entity weaponentity
                        {
                                // don't force reload an empty shotgun if its melee attack is active
                                if(WEP_CVAR(shotgun, secondary) < 2) {
-                                       thiswep.wr_reload(thiswep);
+                                       thiswep.wr_reload(thiswep, actor, weaponentity);
                                }
                        }
                        else
@@ -307,7 +307,7 @@ void W_Shotgun_Attack3_Frame1(Weapon thiswep, entity actor, .entity weaponentity
                                default: return false; // secondary unavailable
                        }
                }
-               METHOD(Shotgun, wr_reload, void(entity thiswep))
+               METHOD(Shotgun, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
                {
                        W_Reload(self, WEP_CVAR_PRI(shotgun, ammo), SND(RELOAD)); // WEAPONTODO
                }
index bb750d72114bf07c6a1daa7e6492566196c85eb5..ebf4881df669df53226c69180470d50ad425ccb1 100644 (file)
@@ -1,6 +1,5 @@
 #ifndef IMPLEMENTATION
 CLASS(Tuba, Weapon)
-/* ammotype  */ //ATTRIB(Tuba, ammo_field, .int, ammo_none)
 /* impulse   */ ATTRIB(Tuba, impulse, int, 1)
 /* flags     */ ATTRIB(Tuba, spawnflags, int, WEP_FLAG_HIDDEN | WEP_TYPE_SPLASH);
 /* rating    */ ATTRIB(Tuba, bot_pickupbasevalue, float, BOT_PICKUP_RATING_MID);
@@ -37,10 +36,11 @@ CLASS(Tuba, Weapon)
        END()
     W_PROPS(X, Tuba, tuba)
 #undef X
-
 ENDCLASS(Tuba)
 REGISTER_WEAPON(TUBA, tuba, NEW(Tuba));
+#endif
 
+#ifdef IMPLEMENTATION
 
 #ifdef SVQC
 
@@ -52,11 +52,7 @@ REGISTER_WEAPON(TUBA, tuba, NEW(Tuba));
 .float tuba_lastnotes_last;
 .float tuba_lastnotes_cnt; // over
 .vector tuba_lastnotes[MAX_TUBANOTES];
-#endif
-#endif
 
-#ifdef IMPLEMENTATION
-#ifdef SVQC
 spawnfunc(weapon_tuba) { weapon_defaultspawnfunc(this, WEP_TUBA); }
 
 bool W_Tuba_HasPlayed(entity pl, string melody, int instrument, bool ignorepitch, float mintempo, float maxtempo)
@@ -150,40 +146,40 @@ bool W_Tuba_HasPlayed(entity pl, string melody, int instrument, bool ignorepitch
        return true;
 }
 
-void W_Tuba_NoteOff()
-{SELFPARAM();
+void W_Tuba_NoteOff(entity this)
+{
+       entity actor = this.owner;
        // we have a note:
-       //   on: self.spawnshieldtime
+       //   on: this.spawnshieldtime
        //   off: time
-       //   note: self.cnt
-       if(self.owner.tuba_note == self)
+       //   note: this.cnt
+       if (actor.tuba_note == this)
        {
-               self.owner.tuba_lastnotes_last = (self.owner.tuba_lastnotes_last + 1) % MAX_TUBANOTES;
-               self.owner.(tuba_lastnotes[self.owner.tuba_lastnotes_last]) = eX * self.spawnshieldtime + eY * time + eZ * self.cnt;
-               self.owner.tuba_note = world;
-               self.owner.tuba_lastnotes_cnt = bound(0, self.owner.tuba_lastnotes_cnt + 1, MAX_TUBANOTES);
-
-               string s;
-               s = trigger_magicear_processmessage_forallears(self.owner, 0, world, string_null);
-               if(s != "")
+               actor.tuba_lastnotes_last = (actor.tuba_lastnotes_last + 1) % MAX_TUBANOTES;
+               actor.(tuba_lastnotes[actor.tuba_lastnotes_last]) = eX * this.spawnshieldtime + eY * time + eZ * this.cnt;
+               actor.tuba_note = NULL;
+               actor.tuba_lastnotes_cnt = bound(0, actor.tuba_lastnotes_cnt + 1, MAX_TUBANOTES);
+
+               string s = trigger_magicear_processmessage_forallears(actor, 0, NULL, string_null);
+               if (s != "")
                {
                        // simulate a server message
-                       switch(self.tuba_instrument)
+                       switch (this.tuba_instrument)
                        {
                                default:
                                case 0: // Tuba
-                                       bprint(strcat("\{1}\{13}* ^3", self.owner.netname, "^3 played on the @!#%'n Tuba: ^7", s, "\n"));
+                                       bprint(strcat("\{1}\{13}* ^3", actor.netname, "^3 played on the @!#%'n Tuba: ^7", s, "\n"));
                                        break;
                                case 1:
-                                       bprint(strcat("\{1}\{13}* ^3", self.owner.netname, "^3 played on the @!#%'n Accordeon: ^7", s, "\n"));
+                                       bprint(strcat("\{1}\{13}* ^3", actor.netname, "^3 played on the @!#%'n Accordeon: ^7", s, "\n"));
                                        break;
                                case 2:
-                                       bprint(strcat("\{1}\{13}* ^3", self.owner.netname, "^3 played on the @!#%'n Klein Bottle: ^7", s, "\n"));
+                                       bprint(strcat("\{1}\{13}* ^3", actor.netname, "^3 played on the @!#%'n Klein Bottle: ^7", s, "\n"));
                                        break;
                        }
                }
        }
-       remove(self);
+       remove(this);
 }
 
 int W_Tuba_GetNote(entity pl, int hittype)
@@ -195,7 +191,7 @@ int W_Tuba_GetNote(entity pl, int hittype)
        else if (pl.movement.y > 0)     movestate += 1;
 
        int note = 0;
-       switch(movestate)
+       switch (movestate)
        {
        // layout: originally I wanted
        //   eb e  e#=f
@@ -256,28 +252,24 @@ int W_Tuba_GetNote(entity pl, int hittype)
 
 bool W_Tuba_NoteSendEntity(entity this, entity to, int sf)
 {
-       int f;
-
        msg_entity = to;
-       if(!sound_allowed(MSG_ONE, self.realowner))
-               return false;
+       if (!sound_allowed(MSG_ONE, this.realowner)) return false;
 
        WriteHeader(MSG_ENTITY, ENT_CLIENT_TUBANOTE);
        WriteByte(MSG_ENTITY, sf);
-       if(sf & 1)
+       if (sf & 1)
        {
-               WriteChar(MSG_ENTITY, self.cnt);
-               f = 0;
-               if(self.realowner != to)
-                       f |= 1;
-               f |= 2 * self.tuba_instrument;
+               WriteChar(MSG_ENTITY, this.cnt);
+               int f = 0;
+               f |= 1 * (this.realowner != to);
+               f |= 2 * this.tuba_instrument;
                WriteByte(MSG_ENTITY, f);
        }
-       if(sf & 2)
+       if (sf & 2)
        {
-               WriteCoord(MSG_ENTITY, self.origin.x);
-               WriteCoord(MSG_ENTITY, self.origin.y);
-               WriteCoord(MSG_ENTITY, self.origin.z);
+               WriteCoord(MSG_ENTITY, this.origin.x);
+               WriteCoord(MSG_ENTITY, this.origin.y);
+               WriteCoord(MSG_ENTITY, this.origin.z);
        }
        return true;
 }
@@ -290,7 +282,7 @@ void W_Tuba_NoteThink()
        vector v;
        if(time > self.teleport_time)
        {
-               W_Tuba_NoteOff();
+               W_Tuba_NoteOff(this);
                return;
        }
        self.nextthink = time;
@@ -336,13 +328,13 @@ void W_Tuba_NoteOn(float hittype)
        {
                if(self.tuba_note.cnt != n || self.tuba_note.tuba_instrument != self.tuba_instrument)
                {
-                       WITH(entity, self, self.tuba_note, W_Tuba_NoteOff());
+                       W_Tuba_NoteOff(self.tuba_note);
                }
        }
 
        if(!self.tuba_note)
        {
-               self.tuba_note = spawn();
+               self.tuba_note = new(tuba_note);
                self.tuba_note.owner = self.tuba_note.realowner = self;
                self.tuba_note.cnt = n;
                self.tuba_note.tuba_instrument = self.tuba_instrument;
@@ -355,7 +347,7 @@ void W_Tuba_NoteOn(float hittype)
        self.tuba_note.teleport_time = time + WEP_CVAR(tuba, refire) * 2 * W_WeaponRateFactor(); // so it can get prolonged safely
 
        //sound(self, c, TUBA_NOTE(n), bound(0, VOL_BASE * cvar("g_balance_tuba_volume"), 1), autocvar_g_balance_tuba_attenuation);
-       RadiusDamage(self, self, WEP_CVAR(tuba, damage), WEP_CVAR(tuba, edgedamage), WEP_CVAR(tuba, radius), world, world, WEP_CVAR(tuba, force), hittype | WEP_TUBA.m_id, world);
+       RadiusDamage(self, self, WEP_CVAR(tuba, damage), WEP_CVAR(tuba, edgedamage), WEP_CVAR(tuba, radius), NULL, NULL, WEP_CVAR(tuba, force), hittype | WEP_TUBA.m_id, NULL);
 
        o = gettaginfo(self.exteriorweaponentity, 0);
        if(time > self.tuba_smoketime)
@@ -364,101 +356,132 @@ void W_Tuba_NoteOn(float hittype)
                self.tuba_smoketime = time + 0.25;
        }
 }
+#endif
 
-               METHOD(Tuba, wr_aim, void(entity thiswep))
-               {
-                       // bots cannot play the Tuba well yet
-                       // I think they should start with the recorder first
-                       if(vlen(self.origin - self.enemy.origin) < WEP_CVAR(tuba, radius))
-                       {
-                               if(random() > 0.5)
-                                       self.BUTTON_ATCK = 1;
-                               else
-                                       self.BUTTON_ATCK2 = 1;
-                       }
-               }
-               METHOD(Tuba, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
-               {
-                       if(fire & 1)
-                       if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(tuba, refire)))
-                       {
-                               W_Tuba_NoteOn(0);
-                               //weapon_thinkf(actor, WFRAME_FIRE1, autocvar_g_balance_tuba_animtime, w_ready);
-                               weapon_thinkf(actor, weaponentity, WFRAME_IDLE, WEP_CVAR(tuba, animtime), w_ready);
-                       }
-                       if(fire & 2)
-                       if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR(tuba, refire)))
-                       {
-                               W_Tuba_NoteOn(HITTYPE_SECONDARY);
-                               //weapon_thinkf(actor, WFRAME_FIRE2, autocvar_g_balance_tuba_animtime, w_ready);
-                               weapon_thinkf(actor, weaponentity, WFRAME_IDLE, WEP_CVAR(tuba, animtime), w_ready);
-                       }
-                       if(actor.tuba_note)
-                       {
-                               if(!(fire & 1) && !(fire & 2))
-                               {
-                                       WITH(entity, self, actor.tuba_note, W_Tuba_NoteOff());
-                               }
-                       }
-               }
-               METHOD(Tuba, wr_setup, void(entity thiswep))
-               {
-                       self.ammo_field = ammo_none;
-                       self.tuba_instrument = 0;
-               }
-               METHOD(Tuba, wr_reload, void(entity thiswep))
-               {
-                       .entity weaponentity = weaponentities[0]; // TODO: unhardcode
-                       // switch to alternate instruments :)
-                       if(self.(weaponentity).state == WS_READY)
-                       {
-                               switch(self.tuba_instrument)
-                               {
-                                       case 0:
-                                               self.tuba_instrument = 1;
-                                               self.weaponname = "akordeon";
-                                               break;
-                                       case 1:
-                                               self.tuba_instrument = 2;
-                                               self.weaponname = "kleinbottle";
-                                               break;
-                                       case 2:
-                                               self.tuba_instrument = 0;
-                                               self.weaponname = "tuba";
-                                               break;
-                               }
-                               W_SetupShot(self, false, 0, "", 0, 0);
-                               Send_Effect(EFFECT_TELEPORT, w_shotorg, '0 0 0', 1);
-                               self.(weaponentity).state = WS_INUSE;
-                               weapon_thinkf(self, weaponentity, WFRAME_RELOAD, 0.5, w_ready);
-                       }
-               }
-               METHOD(Tuba, wr_checkammo1, bool(entity thiswep))
-               {
-                       return true; // infinite ammo
-               }
-               METHOD(Tuba, wr_checkammo2, bool(entity thiswep))
-               {
-                       return true; // tuba has infinite ammo
-               }
-               METHOD(Tuba, wr_suicidemessage, int(entity thiswep))
+#ifdef SVQC
+METHOD(Tuba, wr_aim, void(Tuba this))
+{
+       entity actor = self;
+       // bots cannot play the Tuba well yet
+       // I think they should start with the recorder first
+       if (vdist((actor.origin - actor.enemy.origin), <, WEP_CVAR(tuba, radius)))
+       {
+               if (random() > 0.5)
+                       actor.BUTTON_ATCK = 1;
+               else
+                       actor.BUTTON_ATCK2 = 1;
+       }
+}
+
+METHOD(Tuba, wr_think, void(Tuba this, entity actor, .entity weaponentity, int fire))
+{
+       if (fire & 1)
+       if (weapon_prepareattack(this, actor, weaponentity, false, WEP_CVAR(tuba, refire)))
+       {
+               W_Tuba_NoteOn(0);
+               weapon_thinkf(actor, weaponentity, WFRAME_IDLE, WEP_CVAR(tuba, animtime), w_ready);
+       }
+       if (fire & 2)
+       if (weapon_prepareattack(this, actor, weaponentity, true, WEP_CVAR(tuba, refire)))
+       {
+               W_Tuba_NoteOn(HITTYPE_SECONDARY);
+               weapon_thinkf(actor, weaponentity, WFRAME_IDLE, WEP_CVAR(tuba, animtime), w_ready);
+       }
+       if (actor.tuba_note)
+       {
+               if (!(fire & 1) && !(fire & 2))
                {
-                       if(w_deathtype & HITTYPE_BOUNCE)
-                               return WEAPON_KLEINBOTTLE_SUICIDE;
-                       else if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_ACCORDEON_SUICIDE;
-                       else
-                               return WEAPON_TUBA_SUICIDE;
+                       W_Tuba_NoteOff(actor.tuba_note);
                }
-               METHOD(Tuba, wr_killmessage, int(entity thiswep))
+       }
+}
+
+METHOD(Tuba, wr_setup, void(Tuba this))
+{
+       entity actor = self;
+       actor.ammo_field = ammo_none;
+       actor.tuba_instrument = 0;
+}
+#endif
+
+REGISTER_NET_S2C(tuba_instrument)
+#ifdef CSQC
+NET_HANDLE(tuba_instrument, bool)
+{
+       int i = ReadByte();
+       return = true;
+       string s = (i == 0) ? "tuba" :
+                  (i == 1) ? "akordeon" :
+                             "kleinbottle" ;
+       CL_WeaponEntity_SetModel(viewmodel, s);
+}
+#endif
+#ifdef SVQC
+void tuba_instrument_send(entity this, int instr)
+{
+       msg_entity = this;
+       int chan = MSG_ONE;
+       WriteHeader(chan, tuba_instrument);
+       WriteByte(chan, instr);
+}
+SPECTATE_COPY()
+{
+       if (this.tuba_instrument != spectatee.tuba_instrument)
+               tuba_instrument_send(this, this.tuba_instrument = spectatee.tuba_instrument);
+}
+METHOD(Tuba, wr_reload, void(Tuba this, entity actor, .entity weaponentity))
+{
+       // switch to alternate instruments :)
+       if (actor.(weaponentity).state == WS_READY)
+       {
+               switch (actor.tuba_instrument)
                {
-                       if(w_deathtype & HITTYPE_BOUNCE)
-                               return WEAPON_KLEINBOTTLE_MURDER;
-                       else if(w_deathtype & HITTYPE_SECONDARY)
-                               return WEAPON_ACCORDEON_MURDER;
-                       else
-                               return WEAPON_TUBA_MURDER;
+                       case 0:
+                               actor.tuba_instrument = 1;
+                               actor.weaponname = "akordeon";
+                               break;
+                       case 1:
+                               actor.tuba_instrument = 2;
+                               actor.weaponname = "kleinbottle";
+                               break;
+                       case 2:
+                               actor.tuba_instrument = 0;
+                               actor.weaponname = "tuba";
+                               break;
                }
+               tuba_instrument_send(actor, actor.tuba_instrument);
+               W_SetupShot(actor, false, 0, "", 0, 0);
+               Send_Effect(EFFECT_TELEPORT, w_shotorg, '0 0 0', 1);
+               actor.(weaponentity).state = WS_INUSE;
+               weapon_thinkf(actor, weaponentity, WFRAME_RELOAD, 0.5, w_ready);
+       }
+}
+#endif
+
+#ifdef SVQC
+
+// infinite ammo
+METHOD(Tuba, wr_checkammo1, bool(Tuba this)) { return true; }
+METHOD(Tuba, wr_checkammo2, bool(Tuba this)) { return true; }
+
+METHOD(Tuba, wr_suicidemessage, int(Tuba this))
+{
+       if (w_deathtype & HITTYPE_BOUNCE)
+               return WEAPON_KLEINBOTTLE_SUICIDE;
+       else if (w_deathtype & HITTYPE_SECONDARY)
+               return WEAPON_ACCORDEON_SUICIDE;
+       else
+               return WEAPON_TUBA_SUICIDE;
+}
+METHOD(Tuba, wr_killmessage, int(Tuba this))
+{
+       if (w_deathtype & HITTYPE_BOUNCE)
+               return WEAPON_KLEINBOTTLE_MURDER;
+       else if (w_deathtype & HITTYPE_SECONDARY)
+               return WEAPON_ACCORDEON_MURDER;
+       else
+               return WEAPON_TUBA_MURDER;
+}
 
 #endif
 
@@ -533,36 +556,36 @@ void Ent_TubaNote_Think()
 {SELFPARAM();
        float f = autocvar_g_balance_tuba_fadetime;
        if (f > 0) {
-               self.tuba_volume -= frametime * self.tuba_volume_initial / f;
+               this.tuba_volume -= frametime * this.tuba_volume_initial / f;
        } else {
-               self.tuba_volume = 0;
+               this.tuba_volume = 0;
        }
-       self.nextthink = time;
-       if (self.tuba_volume <= 0) {
-               sound(self, CH_TUBA_SINGLE, SND_Null, 0, 0);
-               if (self.enemy) {
-                       sound(self.enemy, CH_TUBA_SINGLE, SND_Null, 0, 0);
-                       remove(self.enemy);
+       this.nextthink = time;
+       if (this.tuba_volume <= 0) {
+               sound(this, CH_TUBA_SINGLE, SND_Null, 0, 0);
+               if (this.enemy) {
+                       sound(this.enemy, CH_TUBA_SINGLE, SND_Null, 0, 0);
+                       remove(this.enemy);
                }
-               remove(self);
+               remove(this);
        } else {
-               tubasound(self, 0);
+               tubasound(this, 0);
        }
 }
 
-void Ent_TubaNote_UpdateSound()
-{SELFPARAM();
-       self.enemy.tuba_volume = bound(0, VOL_BASE * autocvar_g_balance_tuba_volume, 1);
-       self.enemy.tuba_volume_initial = self.enemy.tuba_volume;
-       self.enemy.note = self.note;
-       self.enemy.tuba_instrument = self.tuba_instrument;
-       tubasound(self.enemy, 1);
+void Ent_TubaNote_UpdateSound(entity this)
+{
+       this.enemy.tuba_volume = bound(0, VOL_BASE * autocvar_g_balance_tuba_volume, 1);
+       this.enemy.tuba_volume_initial = this.enemy.tuba_volume;
+       this.enemy.note = this.note;
+       this.enemy.tuba_instrument = this.tuba_instrument;
+       tubasound(this.enemy, 1);
 }
 
 void Ent_TubaNote_StopSound()
 {SELFPARAM();
-       self.enemy.nextthink = time;
-       self.enemy = world;
+       this.enemy.nextthink = time;
+       this.enemy = NULL;
 }
 
 NET_HANDLE(ENT_CLIENT_TUBANOTE, bool isNew)
@@ -575,44 +598,44 @@ NET_HANDLE(ENT_CLIENT_TUBANOTE, bool isNew)
                bool att = (i & 1);
                i >>= 1;
 
-               if (self.enemy) {
-                       if (n != self.note || i != self.tuba_instrument || isNew) {
+               if (this.enemy) {
+                       if (n != this.note || i != this.tuba_instrument || isNew) {
                                Ent_TubaNote_StopSound();
                        }
                } else {
-                       self.enemy = new(tuba_note);
+                       this.enemy = new(tuba_note);
                        if (Tuba_PitchStep) {
-                               self.enemy.enemy = new(tuba_note_2);
+                               this.enemy.enemy = new(tuba_note_2);
                        }
                        isNew = true;
                }
 
-               self.enemy.tuba_attenuate = att;
+               this.enemy.tuba_attenuate = att;
 
                if (isNew) {
-                       self.note = n;
-                       self.tuba_instrument = i;
+                       this.note = n;
+                       this.tuba_instrument = i;
                        upd = true;
                }
        }
 
        if (f & 2) {
-               self.enemy.origin_x = ReadCoord();
-               self.enemy.origin_y = ReadCoord();
-               self.enemy.origin_z = ReadCoord();
-               setorigin(self.enemy, self.enemy.origin);
-               if (self.enemy.enemy) {
-                       setorigin(self.enemy.enemy, self.enemy.origin);
+               this.enemy.origin_x = ReadCoord();
+               this.enemy.origin_y = ReadCoord();
+               this.enemy.origin_z = ReadCoord();
+               setorigin(this.enemy, this.enemy.origin);
+               if (this.enemy.enemy) {
+                       setorigin(this.enemy.enemy, this.enemy.origin);
                }
        }
 
-       self.think = Ent_TubaNote_StopSound;
-       self.entremove = Ent_TubaNote_StopSound;
-       self.enemy.think = Ent_TubaNote_Think;
-       self.enemy.nextthink = time + 10;
+       this.think = Ent_TubaNote_StopSound;
+       this.entremove = Ent_TubaNote_StopSound;
+       this.enemy.think = Ent_TubaNote_Think;
+       this.enemy.nextthink = time + 10;
 
        if (upd) {
-               Ent_TubaNote_UpdateSound();
+               Ent_TubaNote_UpdateSound(this);
        }
        return true;
 }
@@ -622,7 +645,7 @@ PRECACHE(Tuba)
        Tuba_PitchStep = autocvar_g_balance_tuba_pitchstep;
        if (Tuba_PitchStep) {
                if (!checkextension("DP_SND_SOUND7_WIP2") && !checkextension("DP_SND_SOUND7")) {
-                       LOG_INFO("^1NOTE:^7 requested pitch shifting, but not supported by this engine build\n");
+                       LOG_WARNING("requested pitch shifting, but not supported by this engine build");
                        Tuba_PitchStep = 0;
                }
        }
index d3c47ee5fa031adf2caab63baef747aa9c3bf658..f7c14d9f6f492e3185139b7228b56e7fd46c6c38 100644 (file)
@@ -351,9 +351,9 @@ void W_RocketMinsta_Attack3 ()
                        float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
                        // if the laser uses load, we also consider its ammo for reloading
                        if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && actor.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep);
+                               thiswep.wr_reload(thiswep, actor, weaponentity);
                        } else if(WEP_CVAR(vaporizer, reload_ammo) && actor.clip_load < vaporizer_ammo) { // forced reload
-                               thiswep.wr_reload(thiswep);
+                               thiswep.wr_reload(thiswep, actor, weaponentity);
                        }
                        if((fire & 1) && (actor.ammo_cells || !autocvar_g_rm) && !forbidWeaponUse(actor))
                        {
@@ -444,7 +444,7 @@ void W_RocketMinsta_Attack3 ()
                {
                        self.vaporizer_lasthit = 0;
                }
-               METHOD(Vaporizer, wr_reload, void(entity thiswep))
+               METHOD(Vaporizer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
                {
                        float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
                        float used_ammo;
index 21e4dc92e517c572730d3bdc9d622baf51180626..83ea7e597643820988d78ea5e040b7888d838d46 100644 (file)
@@ -234,7 +234,7 @@ void W_Vortex_Attack(Weapon thiswep, float issecondary)
                                }
 
                        if(autocvar_g_balance_vortex_reload_ammo && actor.clip_load < min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo))) { // forced reload
-                               thiswep.wr_reload(thiswep);
+                               thiswep.wr_reload(thiswep, actor, weaponentity);
                        } else
                        {
                                if(fire & 1)
@@ -354,7 +354,7 @@ void W_Vortex_Attack(Weapon thiswep, float issecondary)
                        }
                        self.vortex_lasthit = 0;
                }
-               METHOD(Vortex, wr_reload, void(entity thiswep))
+               METHOD(Vortex, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
                {
                        W_Reload(self, min(WEP_CVAR_PRI(vortex, ammo), WEP_CVAR_SEC(vortex, ammo)), SND(RELOAD));
                }
index 2473d672c24d87b746dc15a0aaa0faeade8b1ec9..cfd083547a2bf09de3ef4a191e74729df53d2aa0 100644 (file)
@@ -346,8 +346,9 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); }
                }
 
                // allow writing to also pass through to spectators (like so spectators see the same centerprints as players for example)
-               #define WRITESPECTATABLE_MSG_ONE(statement) MACRO_BEGIN { \
-                       entity dst = msg_entity; \
+               #define WRITESPECTATABLE_MSG_ONE(to, statement) MACRO_BEGIN { \
+                       entity prev = msg_entity; \
+                       entity dst = to; \
                        FOREACH_CLIENT(IS_REAL_CLIENT(it), { \
                                if (it == dst || (it.classname == STR_SPECTATOR && it.enemy == dst)) \
                                { \
@@ -355,7 +356,7 @@ STATIC_INIT(C2S_Protocol_renumber) { FOREACH(C2S_Protocol, true, it.m_id = i); }
                                        LAMBDA(statement); \
                                } \
                        }); \
-                       msg_entity = dst; \
+                       msg_entity = prev; \
                } MACRO_END
        #endif
 #endif
index a0dfd72f8218722b3c8858e71a8b7b3c3f7bb5c5..b4c125c6bac84f93aad5bedb1a63ed83eb231c7f 100644 (file)
@@ -8,6 +8,7 @@ float CalcRotRegen(float current, float regenstable, float regenfactor, float re
 
 float Spectate(entity pl);
 
-#define SPECTATE_COPY(fld) [[accumulate]] void SpectateCopy(entity this, entity spectatee) { this.(fld) = spectatee.(fld); }
+#define SPECTATE_COPY() [[accumulate]] void SpectateCopy(entity this, entity spectatee)
+#define SPECTATE_COPYFIELD(fld) SPECTATE_COPY() { this.(fld) = spectatee.(fld); }
 
 #endif
index ecd4ae07e58e2e6c9c30ea6716c6d3b13db68561..96e48cb64693458ad45e9719fc554da4747efa12 100644 (file)
@@ -218,7 +218,9 @@ IMPULSE(weapon_reload)
        if (this.deadflag != DEAD_NO) return;
        if (forbidWeaponUse(this)) return;
        Weapon w = PS(this).m_weapon;
-       w.wr_reload(w);
+       entity actor = this;
+       .entity weaponentity = weaponentities[0]; // TODO: unhardcode
+       w.wr_reload(w, actor, weaponentity);
 }
 
 void ImpulseCommands(entity this)
index 42d7e5dd644adefce60ec845dd24e618f583ae6c..f014f1a2b61a78dab91365219468177b1337618f 100644 (file)
@@ -171,7 +171,7 @@ void race_SendNextCheckpoint(entity e, float spec) // qualifying only
 
        if(!spec)
                msg_entity = e;
-       WRITESPECTATABLE_MSG_ONE({
+       WRITESPECTATABLE_MSG_ONE(msg_entity, {
                WriteHeader(MSG_ONE, TE_CSQC_RACE);
                if(spec)
                {
@@ -236,7 +236,7 @@ void race_SendStatus(float id, entity e)
        else
                msg = MSG_ALL;
        msg_entity = e;
-       WRITESPECTATABLE_MSG_ONE({
+       WRITESPECTATABLE_MSG_ONE(msg_entity, {
                WriteHeader(msg, TE_CSQC_RACE);
                WriteByte(msg, RACE_NET_SERVER_STATUS);
                WriteShort(msg, id);
@@ -444,7 +444,7 @@ void race_SendTime(entity e, float cp, float t, float tvalid)
                        msg_entity = e;
                        if(g_race_qualifying)
                        {
-                               WRITESPECTATABLE_MSG_ONE({
+                               WRITESPECTATABLE_MSG_ONE(msg_entity, {
                                        WriteHeader(MSG_ONE, TE_CSQC_RACE);
                                        WriteByte(MSG_ONE, RACE_NET_CHECKPOINT_HIT_QUALIFYING);
                                        WriteByte(MSG_ONE, race_CheckpointNetworkID(cp)); // checkpoint the player now is at
@@ -472,7 +472,7 @@ void race_SendTime(entity e, float cp, float t, float tvalid)
                if(IS_REAL_CLIENT(e))
                {
                        msg_entity = e;
-                       WRITESPECTATABLE_MSG_ONE({
+                       WRITESPECTATABLE_MSG_ONE(msg_entity, {
                                WriteHeader(MSG_ONE, TE_CSQC_RACE);
                                WriteByte(MSG_ONE, RACE_NET_CHECKPOINT_HIT_RACE);
                                WriteByte(MSG_ONE, race_CheckpointNetworkID(cp)); // checkpoint the player now is at
@@ -498,7 +498,7 @@ void race_SendTime(entity e, float cp, float t, float tvalid)
                if(IS_REAL_CLIENT(oth))
                {
                        msg_entity = oth;
-                       WRITESPECTATABLE_MSG_ONE({
+                       WRITESPECTATABLE_MSG_ONE(msg_entity, {
                                WriteHeader(MSG_ONE, TE_CSQC_RACE);
                                WriteByte(MSG_ONE, RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT);
                                WriteByte(MSG_ONE, race_CheckpointNetworkID(cp)); // checkpoint the player now is at
@@ -531,7 +531,7 @@ void race_ClearTime(entity e)
                return;
 
        msg_entity = e;
-       WRITESPECTATABLE_MSG_ONE({
+       WRITESPECTATABLE_MSG_ONE(msg_entity, {
                WriteHeader(MSG_ONE, TE_CSQC_RACE);
                WriteByte(MSG_ONE, RACE_NET_CHECKPOINT_CLEAR); // next
        });
@@ -1088,7 +1088,7 @@ void race_ImposePenaltyTime(entity pl, float penalty, string reason)
                if(IS_REAL_CLIENT(pl))
                {
                        msg_entity = pl;
-                       WRITESPECTATABLE_MSG_ONE({
+                       WRITESPECTATABLE_MSG_ONE(msg_entity, {
                                WriteHeader(MSG_ONE, TE_CSQC_RACE);
                                WriteByte(MSG_ONE, RACE_NET_PENALTY_QUALIFYING);
                                WriteShort(MSG_ONE, TIME_ENCODE(penalty));
@@ -1102,7 +1102,7 @@ void race_ImposePenaltyTime(entity pl, float penalty, string reason)
                if(IS_REAL_CLIENT(pl))
                {
                        msg_entity = pl;
-                       WRITESPECTATABLE_MSG_ONE({
+                       WRITESPECTATABLE_MSG_ONE(msg_entity, {
                                WriteHeader(MSG_ONE, TE_CSQC_RACE);
                                WriteByte(MSG_ONE, RACE_NET_PENALTY_RACE);
                                WriteShort(MSG_ONE, TIME_ENCODE(penalty));
index 9a4024a6003c04605d0b080ece3363513c8e317e..4a1b0f3f4a91c166ed22495e9d1923333eaa5494 100644 (file)
@@ -260,7 +260,9 @@ void W_SwitchWeapon(Weapon w)
                        self.selectweapon = w.m_id; // update selectweapon ANYWAY
        }
        else if(!forbidWeaponUse(self)) {
-               w.wr_reload(w);
+               entity actor = this;
+               .entity weaponentity = weaponentities[0]; // TODO: unhardcode
+               w.wr_reload(w, actor, weaponentity);
        }
 }