From 5169f0fb0a753be832a978730899f9bba615e35b Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Tue, 18 Dec 2012 10:50:39 +0100 Subject: [PATCH] fix some more uninitialized --- qcsrc/client/hud.qc | 18 +++++++++++++----- qcsrc/client/hud_config.qc | 8 ++++---- qcsrc/client/scoreboard.qc | 7 +++++-- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 13f37b70e..b0322db6f 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -213,7 +213,10 @@ string MakeRaceString(float cp, float mytime, float histime, float lapdelta, str col = "^3"; } else + { col = "^7"; + timestr = ""; + } if(cp == 254) cpname = _("Start line"); @@ -440,21 +443,23 @@ void HUD_Weapons(void) float row, column, rows, columns; float aspect = autocvar_hud_panel_weapons_aspect; - float show_accuracy, panel_weapon_accuracy; + float show_accuracy = false, panel_weapon_accuracy; float timeout = autocvar_hud_panel_weapons_timeout; float timein_effect_length = (autocvar_hud_panel_weapons_timeout_effect ? 0.375 : 0); float timeout_effect_length = (autocvar_hud_panel_weapons_timeout_effect ? 0.75 : 0); - float ammo_type, ammo_full, ammo_alpha; - float barsize_x, barsize_y, baroffset_x, baroffset_y; + float ammo_type, ammo_full; + float barsize_x = 0, barsize_y = 0, baroffset_x = 0, baroffset_y = 0; + vector ammo_color = '1 0 1'; + float ammo_alpha = 1; float when = autocvar_hud_panel_weapons_complainbubble_time; float fadetime = autocvar_hud_panel_weapons_complainbubble_fadetime; vector weapon_pos, weapon_size; local noref vector old_panel_size; // fteqcc sucks - vector color, ammo_color; + vector color; // check to see if we want to continue if(hud != HUD_NORMAL) { return; } @@ -531,6 +536,7 @@ void HUD_Weapons(void) } // do we own this weapon? + weapon_count = 0; for(i = 0; i <= WEP_LAST-WEP_FIRST; ++i) if(WEPSET_CONTAINS_AW(weapons_stat, weaponorder[i].weapon)) ++weapon_count; @@ -670,6 +676,7 @@ void HUD_Weapons(void) acc_col[i] = stov(cvar_string(strcat("accuracy_color", ftos(i)))); } + row = column = 0; for(i = 0; i <= WEP_LAST-WEP_FIRST; ++i) { // retrieve information about the current weapon to be drawn @@ -926,7 +933,7 @@ void HUD_Ammo(void) mySize -= '2 2 0' * panel_bg_padding; } - float rows, columns, row, column; + float rows = 0, columns, row, column; vector ammo_size; if (autocvar_hud_panel_ammo_onlycurrent) ammo_size = mySize; @@ -986,6 +993,7 @@ void HUD_Ammo(void) stat_items = getstati(STAT_ITEMS, 0, 24); if (stat_items & IT_UNLIMITED_WEAPON_AMMO) infinite_ammo = TRUE; + row = column = 0; for (i = 0; i < AMMO_COUNT; ++i) { currently_selected = stat_items & GetAmmoItemCode(i); DrawAmmoItem(pos + eX * column * (ammo_size_x + offset_x) + eY * row * (ammo_size_y + offset_y), ammo_size, i, currently_selected, infinite_ammo); diff --git a/qcsrc/client/hud_config.qc b/qcsrc/client/hud_config.qc index 75c1d2c0e..6e345476e 100644 --- a/qcsrc/client/hud_config.qc +++ b/qcsrc/client/hud_config.qc @@ -658,7 +658,7 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary) con_keys = findkeysforcommand("toggleconsole", 0); keys = tokenize(con_keys); // findkeysforcommand returns data for this - float hit_con_bind, i; + float hit_con_bind = 0, i; for (i = 0; i < keys; ++i) { if(nPrimary == stof(argv(i))) @@ -902,7 +902,7 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary) float HUD_Panel_Check_Mouse_Pos(float allow_move) { - float i, j, border; + float i, j = 0, border; while(j < HUD_PANEL_NUM) { @@ -969,7 +969,7 @@ void HUD_Panel_FirstInDrawQ(float id) panel_order[0] = id; // let's save them into the cvar by some strcat trickery - string s; + string s = ""; for(i = 0; i < HUD_PANEL_NUM; ++i) { s = strcat(s, ftos(panel_order[i]), " "); @@ -982,7 +982,7 @@ void HUD_Panel_FirstInDrawQ(float id) void HUD_Panel_Highlight(float allow_move) { - float i, j, border; + float i, j = 0, border; while(j < HUD_PANEL_NUM) { diff --git a/qcsrc/client/scoreboard.qc b/qcsrc/client/scoreboard.qc index 303be3620..d70bc85f7 100644 --- a/qcsrc/client/scoreboard.qc +++ b/qcsrc/client/scoreboard.qc @@ -306,7 +306,7 @@ void Cmd_HUD_SetFields(float argc) { float i, j, slash; string str, pattern; - float have_name, have_primary, have_secondary, have_separator; + float have_name = 0, have_primary = 0, have_secondary = 0, have_separator = 0; float missing; // TODO: re enable with gametype dependant cvars? @@ -1261,6 +1261,9 @@ void HUD_DrawScoreboard() } else { +#ifdef GMQCC + rgb = '0 0 0'; +#endif rgb_x = autocvar_scoreboard_color_bg_r; rgb_y = autocvar_scoreboard_color_bg_g; rgb_z = autocvar_scoreboard_color_bg_b; @@ -1283,7 +1286,7 @@ void HUD_DrawScoreboard() drawcolorcodedstring(pos, sprintf(_("All-time fastest: %d ^7(%s^7)"), race_speedaward_alltimebest, race_speedaward_alltimebest_holder), hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL); pos_y += 1.25 * hud_fontsize_y; } - pos = HUD_DrawScoreboardRankings(pos, pl, rgb, bg_size); + pos = HUD_DrawScoreboardRankings(pos, playerslots[player_localnum], rgb, bg_size); } else if(autocvar_scoreboard_accuracy && spectatee_status != -1 && !warmup_stage) { if(teamplay) -- 2.39.2