From: MirceaKitsune Date: Sun, 5 Sep 2010 13:31:14 +0000 (+0300) Subject: Some improvements to the sbar ammo code and other fixes X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=03d7763a13f31afc1f39868dd483c225f3ae0160;p=voretournament%2Fvoretournament.git Some improvements to the sbar ammo code and other fixes --- diff --git a/data/defaultVoretournament.cfg b/data/defaultVoretournament.cfg index b3c6db5f..dedc8e93 100644 --- a/data/defaultVoretournament.cfg +++ b/data/defaultVoretournament.cfg @@ -63,8 +63,8 @@ alias asay_noammo "say_team (%l) need %W for %w" alias asay_drop "say_team (%l) dropped %w ; impulse 17" // other aliases -alias +grabber +button6 -alias -grabber -button6 +alias +jetpack +button6 +alias -jetpack -button6 alias ready "cmd ready" alias lockteams "sv_cmd lockteams" alias unlockteams "sv_cmd unlockteams" @@ -435,8 +435,6 @@ set welcome_message_time 8 alias clearmap "disconnect" -set g_grappling_hook 0 "let players spawn with the grappling hook which allows them to pull themselves up" - set leadlimit 0 // this means that timelimit can be overidden globally and fraglimit can be overidden for each game mode: DM/TDM, Domination, CTF. @@ -762,7 +760,7 @@ bind g dropweapon bind f +use // misc -bind r +grabber +bind r +jetpack bind ` toggleconsole bind ~ toggleconsole bind TAB +showscores diff --git a/data/keybinds.txt b/data/keybinds.txt index 30b4f475..85e50c24 100644 --- a/data/keybinds.txt +++ b/data/keybinds.txt @@ -5,7 +5,7 @@ "+moveright" "strafe right" "+jump" "jump / swim" "+crouch" "crouch / sink" -"+grabber" "off-hand grabber / jet pack" +"+jetpack" "jet pack" "" "" "" "Attacking" "+attack" "primary fire" diff --git a/data/qcsrc/client/Main.qc b/data/qcsrc/client/Main.qc index 245323c3..268c6e08 100644 --- a/data/qcsrc/client/Main.qc +++ b/data/qcsrc/client/Main.qc @@ -88,6 +88,8 @@ void CSQC_Init(void) registercmd("-button3"); registercmd("+button4"); registercmd("-button4"); + registercmd("+button6"); + registercmd("-button6"); registercmd("+showaccuracy");registercmd("-showaccuracy"); #ifndef CAMERATEST @@ -387,6 +389,12 @@ float CSQC_ConsoleCommand(string strMessage) } else if(strCmd == "-button3") { // secondary button_attack2 = 0; return false; + } else if(strCmd == "+button6") { // secondary + button_jetpack = 1; + return false; + } else if(strCmd == "-button6") { // secondary + button_jetpack = 0; + return false; } else if(strCmd == "+showscores") { sb_showscores = true; return true; diff --git a/data/qcsrc/client/main.qh b/data/qcsrc/client/main.qh index 7353394b..c35f072c 100644 --- a/data/qcsrc/client/main.qh +++ b/data/qcsrc/client/main.qh @@ -125,6 +125,7 @@ vector view_origin, view_angles, view_forward, view_right, view_up; float button_zoom; float spectatorbutton_zoom; float button_attack2; +float button_jetpack; float activeweapon; float current_viewzoom; float zoomin_effect; diff --git a/data/qcsrc/client/sbar.qc b/data/qcsrc/client/sbar.qc index 527276fc..110d674a 100644 --- a/data/qcsrc/client/sbar.qc +++ b/data/qcsrc/client/sbar.qc @@ -2591,7 +2591,7 @@ float GetAmmoStat(float i) { switch(i) { - case 1: return STAT_FUEL; + case 0: return STAT_FUEL; default: return -1; } } @@ -2600,7 +2600,7 @@ float GetAmmoItemCode(float i) { switch(i) { - case 1: return IT_FUEL; + case 0: return IT_FUEL; default: return -1; } } @@ -2609,7 +2609,7 @@ string GetAmmoPicture(float i) { switch(i) { - case 1: return "gfx/hud/sb_fuel"; + case 0: return "gfx/hud/sb_fuel"; default: return ""; } } @@ -3036,18 +3036,30 @@ void Sbar_Draw (void) if(x < 10) health_pos_x -= 11; // always center Sbar_DrawXNum_Colored(health_pos, x, 22, sbar_alpha_fg); - // fuel ammo - a = getstati(GetAmmoStat(1)); // how much fuel do we have? + // ammo + pos_x = bottom_x + 140; + pos_y = bottom_y - 20; - if (a > 0) { // if we have fuel, draw the amount - float invincibility_time, dt; - invincibility_time = getstatf(STAT_INVINCIBLE_FINISHED); - dt = invincibility_time - time; - pos_x = bottom_x + 140; - pos_y = bottom_y - 20; - drawpic(pos - '98 18 0', GetAmmoPicture(1), '20 20 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + // if we are using the jetpack, show fuel ammo. Otherwise show the ammo of our weapon + if(stat_items & IT_JETPACK && button_jetpack) + { + a = getstati(GetAmmoStat(0)); // how much fuel do we have? + drawpic(pos - '98 18 0', GetAmmoPicture(0), '20 20 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); Sbar_DrawXNum(pos - '144 16 0', a, 3, 0, 16, '1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); } + else + { + float i; + for (i = 0; i < 1; ++i) + { + if (stat_items & GetAmmoItemCode(i)) + { + a = getstati(GetAmmoStat(i)); // how much ammo do we have of type i? + drawpic(pos - '98 18 0', GetAmmoPicture(i), '20 20 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL); + Sbar_DrawXNum(pos - '144 16 0', a, 3, 0, 16, '1 1 1', 0, 0, sbar_alpha_fg, DRAWFLAG_NORMAL); + } + } + } // weapon icon entity e;