From 543d3ac5df6159c81c69829c2837a1dc1bf67f5f Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Tue, 18 Dec 2012 11:23:43 +0100 Subject: [PATCH] fix lots of more uninitialized stuff --- qcsrc/Makefile | 2 +- qcsrc/client/Main.qc | 2 +- qcsrc/client/View.qc | 16 +++++++----- qcsrc/client/announcer.qc | 2 +- qcsrc/client/damage.qc | 6 ++--- qcsrc/client/effects.qc | 10 +++---- qcsrc/client/gibs.qc | 4 +-- qcsrc/client/hud.qc | 53 +++++++++++++++++++++++--------------- qcsrc/client/mapvoting.qc | 2 ++ qcsrc/client/scoreboard.qc | 7 +++++ qcsrc/client/shownames.qc | 2 +- qcsrc/client/wall.qc | 22 +++++++--------- 12 files changed, 73 insertions(+), 55 deletions(-) diff --git a/qcsrc/Makefile b/qcsrc/Makefile index 3c55455ac..d1e9bee8e 100644 --- a/qcsrc/Makefile +++ b/qcsrc/Makefile @@ -6,7 +6,7 @@ QCC ?= fteqcc VERSION_MESSAGE = $(shell $(QCC) --version --help) ifneq (,$(findstring GMQCC,$(VERSION_MESSAGE))) # this is gmqcc -QCCFLAGS ?= -Wall -Wno-field-redeclared -Wno-double-declaration -Wno-assign-function-types -Wno-unused-variable -std=fteqcc -O1 -fshort-logic -ftranslatable-strings -flno $(QCCFLAGS_EXTRA) $(QCCFLAGS_WATERMARK) +QCCFLAGS ?= -Werror -Wall -Wno-field-redeclared -Wno-double-declaration -Wno-assign-function-types -Wno-unused-variable -std=fteqcc -O1 -fshort-logic -ftranslatable-strings -flno $(QCCFLAGS_EXTRA) $(QCCFLAGS_WATERMARK) else # this. is. fteqccccccccccccccccccc! QCCFLAGS ?= -Werror -Wno-Q302 -O3 -Ono-return_only -fno-fastarrays $(QCCFLAGS_EXTRA) $(QCCFLAGS_WATERMARK) diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc index dc8a64a11..77a979216 100644 --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@ -1221,7 +1221,7 @@ float CSQC_Parse_TempEntity() string getcommandkey(string text, string command) { string keys; - float n, j, k, l; + float n, j, k, l = 0; if (!autocvar_hud_showbinds) return text; diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index 9ffe5a738..857cdab4a 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -57,9 +57,11 @@ void Porto_Draw() if(!CheckWireframeBox(porto, p - 48 * v_right - 48 * v_up + 16 * v_forward, 96 * v_right, 96 * v_up, 96 * v_forward)) return; if(portal_number == 1) + { portal1_idx = idx; - if(portal_number >= 2) - break; + if(portal_number >= 2) + break; + } } while(idx >= 2) @@ -962,7 +964,7 @@ void CSQC_UpdateView(float w, float h) } // edge detection postprocess handling done second (used by hud_powerup) - float sharpen_intensity, strength_finished = getstatf(STAT_STRENGTH_FINISHED), invincible_finished = getstatf(STAT_INVINCIBLE_FINISHED); + float sharpen_intensity = 0, strength_finished = getstatf(STAT_STRENGTH_FINISHED), invincible_finished = getstatf(STAT_INVINCIBLE_FINISHED); if (strength_finished - time > 0) { sharpen_intensity += (strength_finished - time); } if (invincible_finished - time > 0) { sharpen_intensity += (invincible_finished - time); } @@ -1084,7 +1086,7 @@ void CSQC_UpdateView(float w, float h) shottype = SHOTTYPE_HITWORLD; vector wcross_color, wcross_size; - string wcross_wep, wcross_name; + string wcross_wep = "", wcross_name; float wcross_scale, wcross_blur; if (autocvar_crosshair_per_weapon || autocvar_crosshair_color_per_weapon) { @@ -1272,9 +1274,9 @@ void CSQC_UpdateView(float w, float h) if (autocvar_crosshair_ring || autocvar_crosshair_ring_reload) { // declarations and stats - float ring_value, ring_scale, ring_alpha, ring_inner_value, ring_inner_alpha; - string ring_image, ring_inner_image; - vector ring_rgb, ring_inner_rgb; + float ring_value = 0, ring_scale = 0, ring_alpha = 0, ring_inner_value = 0, ring_inner_alpha = 0; + string ring_image = string_null, ring_inner_image = string_null; + vector ring_rgb = '0 0 0', ring_inner_rgb = '0 0 0'; ring_scale = autocvar_crosshair_ring_size; diff --git a/qcsrc/client/announcer.qc b/qcsrc/client/announcer.qc index db1ae4133..ec4cc78f6 100644 --- a/qcsrc/client/announcer.qc +++ b/qcsrc/client/announcer.qc @@ -81,7 +81,7 @@ void Announcer_Time() { float timelimit = getstatf(STAT_TIMELIMIT); float timeleft = max(0, timelimit * 60 + getstatf(STAT_GAMESTARTTIME) - time); - float warmup_timeleft; + float warmup_timeleft = 0; if(warmup_stage) if(autocvar_g_warmup_limit > 0) diff --git a/qcsrc/client/damage.qc b/qcsrc/client/damage.qc index ae83d45ee..cc89b03d7 100644 --- a/qcsrc/client/damage.qc +++ b/qcsrc/client/damage.qc @@ -39,7 +39,7 @@ void DamageEffect(vector hitorg, float dmg, float type, float specnum) { // particle effects for players and objects damaged by weapons (eg: flames coming out of victims shot with rockets) - float life, nearestbone; + float life, nearestbone = 0; string specstr, effectname; entity e; @@ -61,7 +61,7 @@ void DamageEffect(vector hitorg, float dmg, float type, float specnum) continue; // player model bone blacklist // now choose the bone closest to impact origin - if(vlen(hitorg - gettaginfo(self, tagnum)) <= vlen(hitorg - gettaginfo(self, nearestbone))) + if(nearestbone == 0 || vlen(hitorg - gettaginfo(self, tagnum)) <= vlen(hitorg - gettaginfo(self, nearestbone))) nearestbone = tagnum; } gettaginfo(self, nearestbone); // set gettaginfo_name @@ -113,7 +113,7 @@ void DamageEffect(vector hitorg, float dmg, float type, float specnum) void Ent_DamageInfo(float isNew) { - float dmg, rad, edge, thisdmg, forcemul, species, hitplayer; + float dmg, rad, edge, thisdmg, forcemul, species, hitplayer = FALSE; vector force, thisforce; entity oldself; diff --git a/qcsrc/client/effects.qc b/qcsrc/client/effects.qc index b695867ca..8c237aade 100644 --- a/qcsrc/client/effects.qc +++ b/qcsrc/client/effects.qc @@ -85,11 +85,11 @@ void Net_ReadLightningarc() { float seglength, drifts, drifte, branchfactor, branchfactor_add; - seglength = autocvar_cl_effects_lightningarc_segmentlength; - drifts = autocvar_cl_effects_lightningarc_drift_start; - drifte = autocvar_cl_effects_lightningarc_drift_end; - branchfactor = autocvar_cl_effects_lightningarc_branchfactor_start; - branchfactor = autocvar_cl_effects_lightningarc_branchfactor_add; + seglength = autocvar_cl_effects_lightningarc_segmentlength; + drifts = autocvar_cl_effects_lightningarc_drift_start; + drifte = autocvar_cl_effects_lightningarc_drift_end; + branchfactor = autocvar_cl_effects_lightningarc_branchfactor_start; + branchfactor_add = autocvar_cl_effects_lightningarc_branchfactor_add; cl_effetcs_lightningarc(from,to,seglength,drifts,drifte,branchfactor,branchfactor_add); } diff --git a/qcsrc/client/gibs.qc b/qcsrc/client/gibs.qc index 22825bc4f..5f6599f18 100644 --- a/qcsrc/client/gibs.qc +++ b/qcsrc/client/gibs.qc @@ -156,7 +156,7 @@ void Ent_GibSplash(float isNew) vector org, vel; string specstr; float issilent; - string gentle_prefix; + string gentle_prefix = "morphed_"; float c, randomvalue; @@ -177,8 +177,6 @@ void Ent_GibSplash(float isNew) gentle_prefix = ""; else if(cl_gentle_gibs == 3) gentle_prefix = "happy_"; - else - gentle_prefix = "morphed_"; } else if(autocvar_cl_particlegibs) { diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index b0322db6f..ee7ff6e8f 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -1143,7 +1143,7 @@ void HUD_Powerups(void) float panel_ar = mySize_x/mySize_y; float is_vertical = (panel_ar < 1); - vector shield_offset, strength_offset, superweapons_offset; + vector shield_offset = '0 0 0', strength_offset = '0 0 0', superweapons_offset = '0 0 0'; float superweapons_is = -1; @@ -1227,6 +1227,7 @@ void HUD_Powerups(void) if(superweapons_is == 0) { + superweapons_offset = '0 0 0'; superweapons_iconalign = strength_iconalign; superweapons_baralign = 2; } @@ -1236,7 +1237,7 @@ void HUD_Powerups(void) superweapons_iconalign = strength_iconalign; superweapons_baralign = strength_baralign; } - else if(superweapons_is == 2) + else // if(superweapons_is == 2) { superweapons_offset = shield_offset; superweapons_iconalign = shield_iconalign; @@ -1433,7 +1434,7 @@ void HUD_HealthArmor(void) { float panel_ar = mySize_x/mySize_y; float is_vertical = (panel_ar < 1); - vector health_offset, armor_offset; + vector health_offset = '0 0 0', armor_offset = '0 0 0'; if (panel_ar >= 4 || (panel_ar >= 1/4 && panel_ar < 1)) { mySize_x *= 0.5; @@ -2669,7 +2670,7 @@ void HUD_UpdatePlayerTeams(); void HUD_Score_Rankings(vector pos, vector mySize, entity me, float team_count) { float score; - entity tm, pl; + entity tm = world, pl; #define SCOREPANEL_MAX_ENTRIES 6 #define SCOREPANEL_ASPECTRATIO 2 float entries = bound(1, floor(SCOREPANEL_MAX_ENTRIES * mySize_y/mySize_x * SCOREPANEL_ASPECTRATIO), SCOREPANEL_MAX_ENTRIES); @@ -2682,13 +2683,11 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me, float team_count) float name_size = mySize_x*0.75; float spacing_size = mySize_x*0.04; const float highlight_alpha = 0.2; - float i, me_printed, first_pl; + float i = 0, me_printed = 0, first_pl = 0; string s; - i = 0; - first_pl = 0; if (autocvar__hud_configure) { - float players_per_team; + float players_per_team = 0; if (team_count) { // show team scores in the first line @@ -2712,7 +2711,7 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me, float team_count) { rgb = '1 1 0'; drawfill(pos, eX * mySize_x + eY * fontsize_y, rgb, highlight_alpha * panel_fg_alpha, DRAWFLAG_NORMAL); - s = GetPlayerName(pl.sv_entnum); + s = GetPlayerName(player_localnum); score = 7; } else @@ -2812,7 +2811,7 @@ void HUD_Score(void) mySize -= '2 2 0' * panel_bg_padding; } - float score, distribution; + float score, distribution = 0; string sign; vector distribution_color; entity tm, pl, me; @@ -2902,8 +2901,8 @@ void HUD_Score(void) drawstring_aspect(pos + eX * 0.75 * mySize_x, distribution_str, eX * 0.25 * mySize_x + eY * (1/3) * mySize_y, distribution_color, panel_fg_alpha, DRAWFLAG_NORMAL); draw_endBoldFont(); } else { // teamgames - float scores_count, row, column, rows, columns; - local noref vector offset; // fteqcc sucks + float scores_count = 0, row, column, rows = 0, columns = 0; + local noref vector offset = '0 0 0'; vector score_pos, score_size; //for scores other than myteam if (spectatee_status == -1 || autocvar_hud_panel_score_rankings) { @@ -2944,6 +2943,7 @@ void HUD_Score(void) float max_fragcount; max_fragcount = -99; draw_beginBoldFont(); + row = column = 0; for(tm = teams.sort_next; tm; tm = tm.sort_next) { if(tm.team == COLOR_SPECTATOR) continue; @@ -3800,6 +3800,8 @@ void HUD_Mod_Race(vector pos, vector mySize) float rank; if(race_status > 0) rank = race_CheckName(race_status_name); + else + rank = 0; string rankname; rankname = race_PlaceName(rank); @@ -3844,6 +3846,11 @@ void DrawDomItem(vector myPos, vector mySize, float aspect_ratio, float layout, float stat, pps_ratio; string pic; vector color; +#ifdef GMQCC + stat = -1; + pic = ""; + color = '0 0 0'; +#endif switch(i) { case 0: @@ -3861,10 +3868,12 @@ void DrawDomItem(vector myPos, vector mySize, float aspect_ratio, float layout, pic = "dom_icon_yellow"; color = '1 1 0'; break; + default: case 3: stat = getstatf(STAT_DOM_PPS_PINK); pic = "dom_icon_pink"; color = '1 0 1'; + break; } pps_ratio = stat / getstatf(STAT_DOM_TOTAL_PPS); @@ -3905,7 +3914,7 @@ void HUD_Mod_Dom(vector myPos, vector mySize) { mod_active = 1; // required in each mod function that always shows something entity tm; - float teams_count; + float teams_count = 0; for(tm = teams.sort_next; tm; tm = tm.sort_next) if(tm.team != COLOR_SPECTATOR) ++teams_count; @@ -3918,7 +3927,7 @@ void HUD_Mod_Dom(vector myPos, vector mySize) columns = ceil(teams_count/rows); int i; - float row, column; + float row = 0, column = 0; for(i=0; i 1) acceleration_progressbar_scale = autocvar_hud_panel_physics_acceleration_progressbar_scale; @@ -4499,7 +4508,7 @@ void HUD_Physics(void) //compute layout float panel_ar = panel_size_x/panel_size_y; - vector speed_offset, acceleration_offset; + vector speed_offset = '0 0 0', acceleration_offset = '0 0 0'; if (panel_ar >= 5 && !acceleration_progressbar_scale) { panel_size_x *= 0.5; @@ -4605,7 +4614,7 @@ void HUD_Physics(void) peak_offset_x = min(top_speed, max_speed)/max_speed * panel_size_x; else if (speed_baralign == 1) peak_offset_x = (1 - min(top_speed, max_speed)/max_speed) * panel_size_x; - else if (speed_baralign == 2) + else // if (speed_baralign == 2) peak_offset_x = min(top_speed, max_speed)/max_speed * panel_size_x * 0.5; //if speed is not 0 the speed progressbar already fetched the color if (speed == 0) @@ -4851,7 +4860,7 @@ void HUD_CenterPrint (void) entries = bound(1, floor(panel_size_y/height), CENTERPRINT_MAX_ENTRIES); float i, j, k, n; - float a, sz, align, current_msg_pos_y, msg_size; + float a, sz, align, current_msg_pos_y = 0, msg_size; vector pos; string ts; @@ -4883,6 +4892,8 @@ void HUD_CenterPrint (void) a = bound(0, (time - (centerprint_expire_time[j] - centerprint_time[j])) / max(0.0001, autocvar_hud_panel_centerprint_fade_in), 1); else if (centerprint_expire_time[j] > time) a = (centerprint_expire_time[j] - time) / max(0.0001, autocvar_hud_panel_centerprint_fade_out); + else + a = 0; // set the size from fading in/out before subsequent fading sz = autocvar_hud_panel_centerprint_fade_minfontsize + a * (1 - autocvar_hud_panel_centerprint_fade_minfontsize); @@ -5137,8 +5148,8 @@ void HUD_Main (void) if(autocvar__hud_panelorder != hud_panelorder_prev) { for(i = 0; i < HUD_PANEL_NUM; ++i) panel_order[i] = -1; - string s; - float p_num, warning; + string s = ""; + float p_num, warning = false; float argc = tokenize_console(autocvar__hud_panelorder); if (argc > HUD_PANEL_NUM) warning = true; diff --git a/qcsrc/client/mapvoting.qc b/qcsrc/client/mapvoting.qc index 7aad4c4ff..e993a7f5e 100644 --- a/qcsrc/client/mapvoting.qc +++ b/qcsrc/client/mapvoting.qc @@ -28,6 +28,8 @@ string MapVote_FormatMapItem(float id, string map, float count, float maxwidth, post = _(" (1 vote)"); else if(count >= 0) post = sprintf(_(" (%d votes)"), count); + else + post = ""; } else post = ""; diff --git a/qcsrc/client/scoreboard.qc b/qcsrc/client/scoreboard.qc index d70bc85f7..b927112c8 100644 --- a/qcsrc/client/scoreboard.qc +++ b/qcsrc/client/scoreboard.qc @@ -1258,6 +1258,13 @@ void HUD_DrawScoreboard() pos = HUD_Scoreboard_MakeTable(pos, tm, rgb, bg_size); } + +#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; } else { diff --git a/qcsrc/client/shownames.qc b/qcsrc/client/shownames.qc index 5309c555e..31a6cb5e8 100644 --- a/qcsrc/client/shownames.qc +++ b/qcsrc/client/shownames.qc @@ -43,7 +43,7 @@ void Draw_ShowNames(entity ent) } // handle tag fading - float overlap, onscreen, crosshairdistance; + float overlap = FALSE, onscreen, crosshairdistance; vector o, eo; o = project_3d_to_2d(ent.origin); diff --git a/qcsrc/client/wall.qc b/qcsrc/client/wall.qc index 807b260ab..e68a62c98 100644 --- a/qcsrc/client/wall.qc +++ b/qcsrc/client/wall.qc @@ -10,9 +10,10 @@ void Ent_Wall_Draw() var .vector fld; if(self.bgmscriptangular) - self.angles = self.saved; + fld = angles; else - self.origin = self.saved; + fld = origin; + self.fld = self.saved; if(self.lodmodelindex1) { @@ -41,10 +42,7 @@ void Ent_Wall_Draw() InterpolateOrigin_Do(); - if(self.bgmscriptangular) - self.saved = self.angles; - else - self.saved = self.origin; + self.saved = self.fld; f = BGMScript(self); if(f >= 0) @@ -74,13 +72,16 @@ void Ent_Wall_Remove() void Ent_Wall() { float f; + var .vector fld; + InterpolateOrigin_Undo(); self.iflags = IFLAG_ANGLES; if(self.bgmscriptangular) - self.angles = self.saved; + fld = angles; else - self.origin = self.saved; + fld = origin; + self.fld = self.saved; f = ReadByte(); @@ -170,10 +171,7 @@ void Ent_Wall() InterpolateOrigin_Note(); - if(self.bgmscriptangular) - self.saved = self.angles; - else - self.saved = self.origin; + self.saved = self.fld; self.entremove = Ent_Wall_Remove; self.draw = Ent_Wall_Draw; -- 2.39.2