Adapt the coloring system in Xonotic. The second player color will no longer be pants...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 6 Jul 2011 20:53:18 +0000 (23:53 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 6 Jul 2011 20:53:18 +0000 (23:53 +0300)
data/defaultVT.cfg
data/qcsrc/server/cl_client.qc
data/qcsrc/server/cl_player.qc
data/qcsrc/server/cl_weapons.qc
data/qcsrc/server/cl_weaponsystem.qc
data/qcsrc/server/defs.qh

index 13f52cc2500ff898f9e523c544cffcff51e98850..48b31cda66911f95c720b0277975d8d57ce98557 100644 (file)
@@ -606,6 +606,8 @@ set g_bloodloss 0   "amount of health below which blood loss occurs"
 \r
 set g_footsteps 1      "serverside footstep sounds"\r
 \r
+set g_deathglow 1.25 "when enabled, players stop glowing after they die (the value specifies glow fading speed)"\r
+\r
 set g_multijump 1      "Number of multiple jumps to allow (jumping again in the air), -1 allows for infinite jumps"\r
 set g_multijump_add 0  "0 = make the current z velocity equal to jumpvelocity, 1 = add jumpvelocity to the current z velocity"\r
 set g_multijump_speed -125     "Minimum vertical speed a player must have in order to jump again"\r
index 42c84e2cedb795ef97c7d92f010dc895544f2dd0..ec685f36ecdebff6b1b45794e283b04cf50fc88f 100644 (file)
@@ -2498,6 +2498,29 @@ void PlayerPreThink (void)
 \r
                if(frametime)\r
                {\r
+\r
+                       if(self.health <= 0 && cvar("g_deathglow"))\r
+                       {\r
+                               if(self.glowmod_x > 0)\r
+                                       self.glowmod_x -= cvar("g_deathglow") * frametime;\r
+                               else\r
+                                       self.glowmod_x = -1;\r
+                               if(self.glowmod_y > 0)\r
+                                       self.glowmod_y -= cvar("g_deathglow") * frametime;\r
+                               else\r
+                                       self.glowmod_y = -1;\r
+                               if(self.glowmod_z > 0)\r
+                                       self.glowmod_z -= cvar("g_deathglow") * frametime;\r
+                               else\r
+                                       self.glowmod_z = -1;\r
+                       }\r
+                       else\r
+                       {\r
+                               // set weapon and player glowmod\r
+                               self.glowmod = colormapPaletteColor(self.clientcolors & 0x0F, TRUE) * 2;\r
+                               self.weaponentity_glowmod = self.glowmod;\r
+                       }\r
+\r
                        player_powerups();\r
                }\r
 \r
index 148170f7f0f898b80df894ef9fbf1194f3a1a748..bae973c7701547f19518e21b114ea901caffc3c2 100644 (file)
@@ -114,6 +114,7 @@ void CopyBody(float keepvelocity)
        self.lip = oldself.lip;\r
        self.colormap = oldself.colormap;\r
        self.colormod = oldself.colormod;\r
+       self.glowmod = oldself.glowmod;\r
        self.iscreature = oldself.iscreature;\r
        self.angles = oldself.angles;\r
        self.avelocity = oldself.avelocity;\r
index 255072f43e3854db8a9f94f516f4f3bc0d579fe1..f908a519440b4ae327fa62df9a8ada469f23d0dd 100644 (file)
@@ -202,6 +202,7 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
                if(startitem_failed)\r
                        return string_null;\r
                wep.colormod = wep.owner.colormod; // used by the regurgitating colors\r
+               wep.glowmod = own.weaponentity_glowmod;\r
                wep.think = thrown_wep_think;\r
                wep.nextthink = time + 0.5;\r
                return "";\r
@@ -238,6 +239,7 @@ string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vecto
                        s = substring(s, 5, -1);\r
                }\r
                wep.colormod = wep.owner.colormod; // used by the regurgitating colors\r
+               wep.glowmod = own.weaponentity_glowmod;\r
                wep.think = thrown_wep_think;\r
                wep.nextthink = time + 0.5;\r
                return s;\r
index cc5e6c623b2007d4bb1befb85fed110ab34dc41d..cf64d15103432df58c14701776e08b9f98968ee8 100644 (file)
@@ -577,12 +577,15 @@ void CL_Weaponentity_Think()
                self.alpha = 1;\r
 \r
        self.colormap = self.owner.colormap;\r
+       self.colormod = self.owner.colormod;\r
+       self.glowmod = self.owner.weaponentity_glowmod;\r
        if (self.weaponentity)\r
        {\r
                self.weaponentity.effects = self.effects;\r
                self.weaponentity.alpha = self.alpha;\r
                self.weaponentity.colormap = self.colormap;\r
                self.weaponentity.colormod = self.owner.colormod; // used by the regurgitating colors\r
+               self.weaponentity.glowmod = self.glowmod;\r
        }\r
 \r
        self.angles = '0 0 0';\r
@@ -841,6 +844,7 @@ void CL_ExteriorWeaponentity_Think()
        }\r
 \r
        self.colormap = self.owner.colormap;\r
+       self.glowmod = self.owner.weaponentity_glowmod;\r
        self.customizeentityforclient = CL_ExteriorWeaponentity_CustomizeEntityForClient;\r
 };\r
 \r
index 14c87aed56b2ea9e2cb5d2b965d5598877b9c836..ba97835bb809f20864bdfce8f4caecd143c3c6a9 100644 (file)
@@ -214,6 +214,7 @@ void setanim(entity e, vector anim, float looping, float override, float restart
 \r
 .entity weaponentity;\r
 .entity exteriorweaponentity;\r
+.vector weaponentity_glowmod;\r
 .float switchweapon;\r
 .float autoswitch;\r
 float weapon_action(float wpn, float wrequest);\r