]> de.git.xonotic.org Git - voretournament/voretournament.git/commitdiff
Some improvements to the sbar ammo code and other fixes
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 5 Sep 2010 13:31:14 +0000 (16:31 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 5 Sep 2010 13:31:14 +0000 (16:31 +0300)
data/defaultVoretournament.cfg
data/keybinds.txt
data/qcsrc/client/Main.qc
data/qcsrc/client/main.qh
data/qcsrc/client/sbar.qc

index b3c6db5f1895c610483c2a2c20624d1f676bb507..dedc8e93a36beb85882a55391d40a905da535365 100644 (file)
@@ -63,8 +63,8 @@ alias asay_noammo "say_team (%l) need %W for %w"
 alias asay_drop "say_team (%l) dropped %w ; impulse 17"\r
 \r
 // other aliases\r
-alias +grabber +button6\r
-alias -grabber -button6\r
+alias +jetpack +button6\r
+alias -jetpack -button6\r
 alias ready "cmd ready"\r
 alias lockteams "sv_cmd lockteams"\r
 alias unlockteams "sv_cmd unlockteams"\r
@@ -435,8 +435,6 @@ set welcome_message_time 8
 \r
 alias clearmap "disconnect"\r
 \r
-set g_grappling_hook 0 "let players spawn with the grappling hook which allows them to pull themselves up"\r
-\r
 set leadlimit 0\r
 \r
 // this means that timelimit can be overidden globally and fraglimit can be overidden for each game mode: DM/TDM, Domination, CTF.\r
@@ -762,7 +760,7 @@ bind g dropweapon
 bind f +use\r
 \r
 // misc\r
-bind r +grabber\r
+bind r +jetpack\r
 bind ` toggleconsole\r
 bind ~ toggleconsole\r
 bind TAB +showscores\r
index 30b4f475aa26ea092a0ccabf57430a939596f4b4..85e50c24c40fa0a2cd69b3dd0fd8b3905921c59f 100644 (file)
@@ -5,7 +5,7 @@
 "+moveright"                            "strafe right"\r
 "+jump"                                 "jump / swim"\r
 "+crouch"                               "crouch / sink"\r
-"+grabber"                              "off-hand grabber / jet pack"\r
+"+jetpack"                              "jet pack"\r
 ""                                      ""\r
 ""                                      "Attacking"\r
 "+attack"                               "primary fire"\r
index 245323c387c448124359578ffcaec37b64a176b9..268c6e0815d50025dca973fd915cb45cd48f02ce 100644 (file)
@@ -88,6 +88,8 @@ void CSQC_Init(void)
        registercmd("-button3");\r
        registercmd("+button4");\r
        registercmd("-button4");\r
+       registercmd("+button6");\r
+       registercmd("-button6");\r
        registercmd("+showaccuracy");registercmd("-showaccuracy");\r
 \r
 #ifndef CAMERATEST\r
@@ -387,6 +389,12 @@ float CSQC_ConsoleCommand(string strMessage)
        } else if(strCmd == "-button3") { // secondary\r
                button_attack2 = 0;\r
                return false;\r
+       } else if(strCmd == "+button6") { // secondary\r
+               button_jetpack = 1;\r
+               return false;\r
+       } else if(strCmd == "-button6") { // secondary\r
+               button_jetpack = 0;\r
+               return false;\r
        } else if(strCmd == "+showscores") {\r
                sb_showscores = true;\r
                return true;\r
index 7353394bbb473229431acab51962c32b32aa8cd0..c35f072c2942a5e7163643d48471c951f710fea4 100644 (file)
@@ -125,6 +125,7 @@ vector view_origin, view_angles, view_forward, view_right, view_up;
 float button_zoom;\r
 float spectatorbutton_zoom;\r
 float button_attack2;\r
+float button_jetpack;\r
 float activeweapon;\r
 float current_viewzoom;\r
 float zoomin_effect;\r
index 527276fc3ace448680868c3ad271b1867fa30bbf..110d674abb050e1641947921b1e58cabbb214e46 100644 (file)
@@ -2591,7 +2591,7 @@ float GetAmmoStat(float i)
 {\r
        switch(i)\r
        {\r
-               case 1: return STAT_FUEL;\r
+               case 0: return STAT_FUEL;\r
                default: return -1;\r
        }\r
 }\r
@@ -2600,7 +2600,7 @@ float GetAmmoItemCode(float i)
 {\r
        switch(i)\r
        {\r
-               case 1: return IT_FUEL;\r
+               case 0: return IT_FUEL;\r
                default: return -1;\r
        }\r
 }\r
@@ -2609,7 +2609,7 @@ string GetAmmoPicture(float i)
 {\r
        switch(i)\r
        {\r
-               case 1: return "gfx/hud/sb_fuel";\r
+               case 0: return "gfx/hud/sb_fuel";\r
                default: return "";\r
        }\r
 }\r
@@ -3036,18 +3036,30 @@ void Sbar_Draw (void)
                if(x < 10) health_pos_x -= 11; // always center\r
                Sbar_DrawXNum_Colored(health_pos, x, 22, sbar_alpha_fg);\r
 \r
-               // fuel ammo\r
-               a = getstati(GetAmmoStat(1)); // how much fuel do we have?\r
+               // ammo\r
+               pos_x = bottom_x + 140;\r
+               pos_y = bottom_y - 20;\r
 \r
-               if (a > 0) { // if we have fuel, draw the amount\r
-                       float invincibility_time, dt;\r
-                       invincibility_time = getstatf(STAT_INVINCIBLE_FINISHED);\r
-                       dt = invincibility_time - time;\r
-                       pos_x = bottom_x + 140;\r
-                       pos_y = bottom_y - 20;\r
-                       drawpic(pos - '98 18 0', GetAmmoPicture(1), '20 20 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+               // if we are using the jetpack, show fuel ammo. Otherwise show the ammo of our weapon\r
+               if(stat_items & IT_JETPACK && button_jetpack)\r
+               {\r
+                       a = getstati(GetAmmoStat(0)); // how much fuel do we have?\r
+                       drawpic(pos - '98 18 0', GetAmmoPicture(0), '20 20 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
                        Sbar_DrawXNum(pos - '144 16 0', a, 3, 0, 16, '1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
                }\r
+               else\r
+               {\r
+                       float i;\r
+                       for (i = 0; i < 1; ++i)\r
+                       {\r
+                               if (stat_items & GetAmmoItemCode(i))\r
+                               {\r
+                                       a = getstati(GetAmmoStat(i)); // how much ammo do we have of type i?\r
+                                       drawpic(pos - '98 18 0', GetAmmoPicture(i), '20 20 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+                                       Sbar_DrawXNum(pos - '144 16 0', a, 3, 0, 16, '1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL);\r
+                               }\r
+                       }\r
+               }\r
 \r
                // weapon icon\r
                entity e;\r