From: Rudolf Polzer Date: Mon, 19 Sep 2011 13:17:11 +0000 (+0200) Subject: Small change: use self.weaponname, not self.weapon, for deciding the weapon model X-Git-Tag: xonotic-v0.6.0~40^2~127 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b1e49bed6f6fab55b7746fcffb6c161a6ead6f6c;p=xonotic%2Fxonotic-data.pk3dir.git Small change: use self.weaponname, not self.weapon, for deciding the weapon model This will later allow the same weapon slot to use multiple models if desired. --- diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index ef05663e5..7adab90f3 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -705,6 +705,7 @@ void PutObserverInServer (void) self.model = ""; self.modelindex = 0; self.weapon = 0; + self.weaponname = ""; self.switchingweapon = 0; self.weaponmodel = ""; self.weaponentity = world; @@ -1111,6 +1112,7 @@ void PutClientInServer (void) self.switchweapon = w_getbestweapon(self); self.cnt = self.switchweapon; self.weapon = 0; + self.weaponname = ""; self.switchingweapon = 0; if(!self.alivetime) diff --git a/qcsrc/server/cl_weaponsystem.qc b/qcsrc/server/cl_weaponsystem.qc index 0b73f3614..af76117fe 100644 --- a/qcsrc/server/cl_weaponsystem.qc +++ b/qcsrc/server/cl_weaponsystem.qc @@ -293,7 +293,6 @@ vector weapon_adjust = '10 0 -15'; .vector weapon_morph4origin; .vector weapon_morph4angles; .float weapon_morph4time; -.string weaponname; #define QCWEAPONANIMATION_ORIGIN(e) ((weapon_offset_x + e.view_ofs_x) * v_forward - (weapon_offset_y + e.view_ofs_y) * v_right + (weapon_offset_z + e.view_ofs_z) * v_up + weapon_adjust) /* @@ -583,9 +582,9 @@ void CL_Weaponentity_Think() self.weaponentity.model = ""; return; } - if (self.cnt != self.owner.weapon || self.dmg != self.owner.modelindex || self.deadflag != self.owner.deadflag) + if (self.weaponname != self.owner.weaponname || self.dmg != self.owner.modelindex || self.deadflag != self.owner.deadflag) { - self.cnt = self.owner.weapon; + self.weaponname = self.owner.weaponname; self.dmg = self.owner.modelindex; self.deadflag = self.owner.deadflag; @@ -789,9 +788,9 @@ void CL_ExteriorWeaponentity_Think() self.model = ""; return; } - if (self.cnt != self.owner.weapon || self.dmg != self.owner.modelindex || self.deadflag != self.owner.deadflag) + if (self.weaponname != self.owner.weaponname || self.dmg != self.owner.modelindex || self.deadflag != self.owner.deadflag) { - self.cnt = self.owner.weapon; + self.weaponname = self.owner.weaponname; self.dmg = self.owner.modelindex; self.deadflag = self.owner.deadflag; if (self.owner.weaponname != "") diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 01966039c..bc05d1b04 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -206,6 +206,7 @@ void setanim(entity e, vector anim, float looping, float override, float restart //.float weapon; // current weapon .float switchweapon; // weapon requested to switch to .float switchingweapon; // weapon currently being switched to (is copied from switchweapon once switch is possible) +.string weaponname; // name of .weapon .float autoswitch; float weapon_action(float wpn, float wrequest);