fix glowmod of weapon entity (no longer assign it to world, make code more consistent)
authorRudolf Polzer <divverent@alientrap.org>
Sun, 12 Dec 2010 16:33:41 +0000 (17:33 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Sun, 12 Dec 2010 16:33:41 +0000 (17:33 +0100)
qcsrc/server/cl_weapons.qc
qcsrc/server/cl_weaponsystem.qc
qcsrc/server/defs.qh
qcsrc/server/w_nex.qc

index cfe0126..6de63b9 100644 (file)
@@ -391,9 +391,8 @@ void W_WeaponFrame()
                        v_forward = fo;
                        v_right = ri;
                        v_up = up;
                        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);
                        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)
                {
                }
                if (time + self.weapon_frametime * 0.5 >= self.weapon_nextthink)
                {
index bb71d59..4f5e760 100644 (file)
@@ -603,12 +603,14 @@ void CL_Weaponentity_Think()
        else
                self.alpha = 1;
 
        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.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';
        }
 
        self.angles = '0 0 0';
@@ -847,6 +849,7 @@ void CL_ExteriorWeaponentity_Think()
                self.angles = ang;
        }
 
                self.angles = ang;
        }
 
+       self.glowmod = self.owner.weaponentity_glowmod;
        self.colormap = self.owner.colormap;
 };
 
        self.colormap = self.owner.colormap;
 };
 
index 76ce748..86a57d4 100644 (file)
@@ -200,6 +200,7 @@ void setanim(entity e, vector anim, float looping, float override, float restart
 
 .entity weaponentity;
 .entity exteriorweaponentity;
 
 .entity weaponentity;
 .entity exteriorweaponentity;
+.vector weaponentity_glowmod;
 .float switchweapon;
 .float autoswitch;
 float weapon_action(float wpn, float wrequest);
 .float switchweapon;
 .float autoswitch;
 float weapon_action(float wpn, float wrequest);
index d3b768f..7b1239b 100644 (file)
@@ -96,15 +96,15 @@ float w_nex(float req)
 
         if(autocvar_g_balance_nex_charge)
         {
 
         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)
             {
 
             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);
             }
         }
 
             }
         }