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 13f52cc..48b31cd 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 42c84e2..ec685f3 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 148170f..bae973c 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 255072f..f908a51 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 cc5e6c6..cf64d15 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 14c87ae..ba97835 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