]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
fix lots of more uninitialized stuff
authorRudolf Polzer <divverent@xonotic.org>
Tue, 18 Dec 2012 10:23:43 +0000 (11:23 +0100)
committerRudolf Polzer <divverent@xonotic.org>
Tue, 18 Dec 2012 10:23:43 +0000 (11:23 +0100)
12 files changed:
qcsrc/Makefile
qcsrc/client/Main.qc
qcsrc/client/View.qc
qcsrc/client/announcer.qc
qcsrc/client/damage.qc
qcsrc/client/effects.qc
qcsrc/client/gibs.qc
qcsrc/client/hud.qc
qcsrc/client/mapvoting.qc
qcsrc/client/scoreboard.qc
qcsrc/client/shownames.qc
qcsrc/client/wall.qc

index 3c55455ace9824e8427975fcdc6159fc8bb641a9..d1e9bee8e17579b55217d5f181e9369c05cde74b 100644 (file)
@@ -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)
index dc8a64a11574e0e4318147841a4495930fb4a4f2..77a9792169edf17e403a89eb5972c5629baf8b7e 100644 (file)
@@ -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;
index 9ffe5a738c67634732ac4716a6fc8e7ccace8106..857cdab4a087f41c330d83ac7259d859db4193e0 100644 (file)
@@ -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;
 
index db1ae41336d5e1eb54d30c437975b7323b330739..ec4cc78f6a06da63fa26b78cc92a2d414d1575b2 100644 (file)
@@ -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)
index ae83d45eea011d890b8b3fd0430866d2b17312ca..cc89b03d79d290420202ccdc083209617ddb0100 100644 (file)
@@ -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;
 
index b695867ca361995522005d50a69a99ab482ec66a..8c237aade92621df131a49b4ef079a10760e1326 100644 (file)
@@ -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);
     }
index 22825bc4f38d4912b70c51922098c20213308581..5f6599f183da88394acab16ff586b69a793bef75 100644 (file)
@@ -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)
        {
index b0322db6f40203d15d66a83b5a2f8ec898ac7491..ee7ff6e8ff93491e6f109d1f19b64b63e0dc096f 100644 (file)
@@ -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<teams_count; ++i)
        {
                vector pos, itemSize;
@@ -4360,7 +4369,7 @@ void HUD_InfoMessages(void)
 
                if(teamplay && !intermission && !spectatee_status && gametype != MAPINFO_TYPE_CA && teamnagger)
                {
-                       float ts_min, ts_max;
+                       float ts_min = 0, ts_max = 0;
                        tm = teams.sort_next;
                        if (tm)
                        {
@@ -4426,7 +4435,7 @@ void HUD_Physics(void)
                panel_size -= '2 2 0' * panel_bg_padding;
        }
 
-       float acceleration_progressbar_scale;
+       float acceleration_progressbar_scale = 0;
        if(autocvar_hud_panel_physics_progressbar && autocvar_hud_panel_physics_acceleration_progressbar_scale > 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;
index 7aad4c4ffdd77b543bee03f612b6fe67e85a02f2..e993a7f5e07e4ed3e8839f2fb13c03f97c1213ea 100644 (file)
@@ -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 = "";
index d70bc85f7958ed9883e8f1177e5bfe2ec36af939..b927112c87caef5798ab66c531b5556e64bbc8d0 100644 (file)
@@ -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
        {
index 5309c555e6085050b6a37b36509cf010964c2deb..31a6cb5e8719f1e5f520f885dae46cd66db88330 100644 (file)
@@ -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);
index 807b260ab2131eb57627aa564505898fdf9a50da..e68a62c986a886823cf62cbc90b4b9dea8358dae 100644 (file)
@@ -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;