]> de.git.xonotic.org Git - voretournament/voretournament.git/commitdiff
Colorize display digits red when ammo is too low
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 4 Mar 2012 00:08:02 +0000 (02:08 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 4 Mar 2012 00:08:02 +0000 (02:08 +0200)
data/defaultVT.cfg
data/qcsrc/server/cl_weaponsystem.qc
docs/TODO.txt

index 9d29a078927a8f877a21926a8858ce85eddca630..5c90a8f6bd68c9896cbca1e88b49c210c225feba 100644 (file)
@@ -650,6 +650,9 @@ set g_multijump 1   "Number of multiple jumps to allow (jumping again in the air),
 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
 \r
+set g_gundisplay_warn_load 10 "display digits will show in warning mode when weapon load is below this amount"\r
+set g_gundisplay_warn_ammo 50 "display digits will show in warning mode when ammo is below this amount"\r
+\r
 // effects\r
 r_glsl_postprocess 1\r
 r_picmipsprites 0 // Voretournament uses sprites that should never be picmipped (team mate, typing, waypoints)\r
index 26246b9e20af0d6042ad24343f28f842ddbac31f..8a9ff0d2ec0fd9e1e2fd3f5d91d7dec55ff37164 100644 (file)
@@ -1592,6 +1592,9 @@ void W_SetupProjectileVelocity(entity missile, float pSpeed, float spread)
 void W_DisplayDigitThink()\r
 {\r
        self.nextthink = time;\r
+       float w_load, w_ammo;\r
+       w_load = self.owner.weapon_load[self.owner.weapon];\r
+       w_ammo = self.owner.(self.owner.current_ammo);\r
 \r
        // the owner has switched to another weapon, remove the digits\r
        if(self.weapon != self.owner.weapon || self.owner.classname != "player" || self.deadflag != DEAD_NO)\r
@@ -1633,21 +1636,39 @@ void W_DisplayDigitThink()
        string txt;\r
        if(self.team) // weapon load display\r
        {\r
-               if(self.owner.weapon_load[self.owner.weapon] <= 0)\r
+               if(w_load <= 0)\r
                {\r
                        self.skin = 11; // unavailable digit\r
                        return;\r
                }\r
                else\r
                {\r
-                       txt = ftos(floor(self.owner.weapon_load[self.owner.weapon]));\r
+                       txt = ftos(floor(w_load));\r
                        txt = substring(txt, self.cnt - 1, 1);\r
                }\r
+\r
+               if(self.owner.weapon_load[self.owner.weapon] <= ceil(cvar("g_gundisplay_warn_load")))\r
+               {\r
+                       // in warning mode, only keep red color\r
+                       if(!self.colormod)\r
+                               self.colormod = '1 1 1';\r
+                       self.colormod_y = 0;\r
+                       self.colormod_z = 0;\r
+               }\r
        }\r
        else // ammo display\r
        {\r
-               txt = ftos(floor(self.owner.(self.owner.current_ammo)));\r
+               txt = ftos(floor(w_ammo));\r
                txt = substring(txt, self.cnt - 1, 1);\r
+\r
+               if(w_ammo <= ceil(cvar("g_gundisplay_warn_ammo")))\r
+               {\r
+                       // in warning mode, only keep red color\r
+                       if(!self.colormod)\r
+                               self.colormod = '1 1 1';\r
+                       self.colormod_y = 0;\r
+                       self.colormod_z = 0;\r
+               }\r
        }\r
 \r
        if((!txt || txt == ""))\r
index 815c730cdbb93b76942bd62901464735c949861a..72c537fcd2dcf96fce72e3ed9fb956fbfd9b7e56 100644 (file)
 \r
 - 0.7: Make sure all effects work for spectators too (such as the macro earthquake effect)\r
 \r
-- 0.7 | 0.8: Make display digits red when ammo or load are too low\r
-\r
 - 0.7 | 0.8: The stomach gurgle sound duration does not match the pitch properly
\ No newline at end of file