From: Rudolf Polzer Date: Sun, 12 Dec 2010 16:33:41 +0000 (+0100) Subject: fix glowmod of weapon entity (no longer assign it to world, make code more consistent) X-Git-Tag: xonotic-v0.1.0preview~47 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=70edab3a313f9b0576987d49a47be0a0a16f9e2c;p=xonotic%2Fxonotic-data.pk3dir.git fix glowmod of weapon entity (no longer assign it to world, make code more consistent) --- diff --git a/qcsrc/server/cl_weapons.qc b/qcsrc/server/cl_weapons.qc index cfe01269e..6de63b937 100644 --- a/qcsrc/server/cl_weapons.qc +++ b/qcsrc/server/cl_weapons.qc @@ -391,9 +391,8 @@ void W_WeaponFrame() v_forward = fo; v_right = ri; v_up = up; - self.weaponentity.weaponentity.glowmod = '0 0 0'; // reset glowmod, weapon think function only *might* set it + self.weaponentity_glowmod = '0 0 0'; // reset glowmod, weapon think function only *might* set it weapon_action(self.weapon, WR_THINK); - self.exteriorweaponentity.glowmod = self.weaponentity.weaponentity.glowmod; // exterior weaponmodel has the same glowmod } if (time + self.weapon_frametime * 0.5 >= self.weapon_nextthink) { diff --git a/qcsrc/server/cl_weaponsystem.qc b/qcsrc/server/cl_weaponsystem.qc index bb71d5965..4f5e76044 100644 --- a/qcsrc/server/cl_weaponsystem.qc +++ b/qcsrc/server/cl_weaponsystem.qc @@ -603,12 +603,14 @@ void CL_Weaponentity_Think() else self.alpha = 1; + self.glowmod = self.owner.weaponentity_glowmod; self.colormap = self.owner.colormap; if (self.weaponentity) { self.weaponentity.effects = self.effects; self.weaponentity.alpha = self.alpha; self.weaponentity.colormap = self.colormap; + self.weaponentity.glowmod = self.glowmod; } self.angles = '0 0 0'; @@ -847,6 +849,7 @@ void CL_ExteriorWeaponentity_Think() self.angles = ang; } + self.glowmod = self.owner.weaponentity_glowmod; self.colormap = self.owner.colormap; }; diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index 76ce748ca..86a57d460 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -200,6 +200,7 @@ void setanim(entity e, vector anim, float looping, float override, float restart .entity weaponentity; .entity exteriorweaponentity; +.vector weaponentity_glowmod; .float switchweapon; .float autoswitch; float weapon_action(float wpn, float wrequest); diff --git a/qcsrc/server/w_nex.qc b/qcsrc/server/w_nex.qc index d3b768fef..7b1239b89 100644 --- a/qcsrc/server/w_nex.qc +++ b/qcsrc/server/w_nex.qc @@ -96,15 +96,15 @@ float w_nex(float req) if(autocvar_g_balance_nex_charge) { - self.weaponentity.weaponentity.glowmod_x = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_half * bound(0, self.weaponentity.weaponentity.glowmod_y + self.nex_charge / autocvar_g_balance_nex_charge_limit, 1); - self.weaponentity.weaponentity.glowmod_y = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_green_half * bound(0, self.weaponentity.weaponentity.glowmod_y + self.nex_charge / autocvar_g_balance_nex_charge_limit, 1); - self.weaponentity.weaponentity.glowmod_z = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_blue_half * bound(0, self.weaponentity.weaponentity.glowmod_z + self.nex_charge / autocvar_g_balance_nex_charge_limit, 1); + self.weaponentity_glowmod_x = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_half * min(1, self.nex_charge / autocvar_g_balance_nex_charge_limit); + self.weaponentity_glowmod_y = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_green_half * min(1, self.nex_charge / autocvar_g_balance_nex_charge_limit); + self.weaponentity_glowmod_z = autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_blue_half * min(1, self.nex_charge / autocvar_g_balance_nex_charge_limit); if(self.nex_charge > autocvar_g_balance_nex_charge_limit) { - self.weaponentity.weaponentity.glowmod_x = self.weaponentity.weaponentity.glowmod_x + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_full * (self.nex_charge - autocvar_g_balance_nex_charge_limit) / (1 - autocvar_g_balance_nex_charge_limit); - self.weaponentity.weaponentity.glowmod_y = self.weaponentity.weaponentity.glowmod_y + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_green_full * (self.nex_charge - autocvar_g_balance_nex_charge_limit) / (1 - autocvar_g_balance_nex_charge_limit); - self.weaponentity.weaponentity.glowmod_z = self.weaponentity.weaponentity.glowmod_z + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_blue_full * (self.nex_charge - autocvar_g_balance_nex_charge_limit) / (1 - autocvar_g_balance_nex_charge_limit); + self.weaponentity_glowmod_x = self.weaponentity_glowmod_x + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_red_full * (self.nex_charge - autocvar_g_balance_nex_charge_limit) / (1 - autocvar_g_balance_nex_charge_limit); + self.weaponentity_glowmod_y = self.weaponentity_glowmod_y + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_green_full * (self.nex_charge - autocvar_g_balance_nex_charge_limit) / (1 - autocvar_g_balance_nex_charge_limit); + self.weaponentity_glowmod_z = self.weaponentity_glowmod_z + autocvar_g_weapon_charge_colormod_hdrmultiplier * autocvar_g_weapon_charge_colormod_blue_full * (self.nex_charge - autocvar_g_balance_nex_charge_limit) / (1 - autocvar_g_balance_nex_charge_limit); } }