]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
fix a few bugs the analyzer found
authorRudolf Polzer <divverent@xonotic.org>
Thu, 26 Apr 2012 11:55:02 +0000 (13:55 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Thu, 26 Apr 2012 11:55:02 +0000 (13:55 +0200)
qcsrc/server/cl_player.qc
qcsrc/server/cl_weaponsystem.qc
qcsrc/server/g_damage.qc
qcsrc/server/g_world.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/w_crylink.qc
qcsrc/server/w_hagar.qc
qcsrc/server/w_minelayer.qc
qcsrc/warpzonelib/common.qc
qcsrc/warpzonelib/server.qc

index 05ce2f9e43da8ecc49c901940716db6b70ab4a8e..fd14d42b8d9aa4718450f3a68591d0a4a04bfc0c 100644 (file)
@@ -599,6 +599,8 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
        vbot = (clienttype(self) == CLIENTTYPE_BOT);
 
        valid_damage_for_weaponstats = 0;
+       awep = 0;
+
        if(vbot || clienttype(self) == CLIENTTYPE_REAL)
        if(abot || clienttype(attacker) == CLIENTTYPE_REAL)
        if(attacker && self != attacker)
@@ -610,8 +612,6 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
                        awep = DEATH_WEAPONOF(deathtype);
                valid_damage_for_weaponstats = 1;
        }
-       else
-               awep = 0;
 
        if(valid_damage_for_weaponstats)
        {
@@ -807,11 +807,12 @@ float Say(entity source, float teamsay, entity privatesay, string msgin, float f
 //   0 = reject
 //  -1 = fake accept
 {
-       string msgstr, colorstr, cmsgstr, namestr, fullmsgstr, sourcemsgstr, fullcmsgstr, sourcecmsgstr, privatemsgprefix;
-       float flood, privatemsgprefixlen;
+       string msgstr, colorstr, cmsgstr, namestr, fullmsgstr, sourcemsgstr, fullcmsgstr, sourcecmsgstr;
+       float flood;
        var .float flood_field;
        entity head;
        float ret;
+       string privatemsgprefix = string_null; float privatemsgprefixlen = 0;
 
        if(!teamsay && !privatesay)
                if(substring(msgin, 0, 1) == " ")
index d2c2546d2f3e091660282b3626e6b5521996011c..824266db021b7b708ff855db04a0022dae369efc 100644 (file)
@@ -69,6 +69,7 @@ vector W_HitPlotNormalizedUntransform(vector org, entity targ, vector screenforw
 
        // x = 0..1 relative to hitbox; y = 0..1 relative to hitbox; z = distance
 
+       mi = ma = targ.origin + 0.5 * (targ.mins + targ.maxs);
        for(i = 0; i < 2; ++i) for(j = 0; j < 2; ++j) for(k = 0; k < 2; ++k)
        {
                thisv = targ.origin;
index 9c686a0115d7e33eb76dda469d4b8c468e6227cf..f0ace5ea889ccd7cfc37ee9f8bd846034438dc2d 100644 (file)
@@ -428,11 +428,12 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
 
                                attacker.taunt_soundtime = time + 1;
 
-                               // TODO: fix this?
-                               if (deathtype == DEATH_CUSTOM)
+                               if (deathtype == DEATH_HURTTRIGGER && inflictor.message2 != "")
+                                       msg = inflictor.message2;
+                               else if (deathtype == DEATH_CUSTOM)
                                        msg = deathmessage;
                                else
-                                       msg = inflictor.message2;
+                                       msg = "";
 
                                if(strstrofs(msg, "%", 0) < 0)
                                        msg = strcat("%s ", msg, " by %s");
@@ -509,6 +510,8 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
                                msg = inflictor.message;
                        else if (deathtype == DEATH_CUSTOM)
                                msg = deathmessage;
+                       else
+                               msg = "";
                        if(strstrofs(msg, "%", 0) < 0)
                                msg = strcat("%s ", msg);
 
index e126e4cb3894a45b9bff9362397e341d3a2f1f9d..f2ce297010bd567ec72b6f810794fd6689017530 100644 (file)
@@ -2074,10 +2074,14 @@ float WinningCondition_RanOutOfSpawns()
        else if(team1_score + team2_score + team3_score + team4_score == 1)
        {
                float t, i;
-               if(team1_score) t = COLOR_TEAM1;
-               if(team2_score) t = COLOR_TEAM2;
-               if(team3_score) t = COLOR_TEAM3;
-               if(team4_score) t = COLOR_TEAM4;
+               if(team1_score)
+                       t = COLOR_TEAM1;
+               else if(team2_score)
+                       t = COLOR_TEAM2;
+               else if(team3_score)
+                       t = COLOR_TEAM3;
+               else // if(team4_score)
+                       t = COLOR_TEAM4;
                CheckAllowedTeams(world);
                for(i = 0; i < MAX_TEAMSCORE; ++i)
                {
index b913e0645ac2d28d68701489ccf3390f03853293..df175ac8d3d6d2b7d46953e385de59f71f974c20 100644 (file)
@@ -2179,7 +2179,7 @@ float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, f
     org = world.mins;
     delta = world.maxs - world.mins;
 
-    start = org;
+    start = end = org;
 
     for (i = 0; i < attempts; ++i)
     {
index 0b3118bb606cea52a6c5115e5bf437ea0a313b6e..e748987cb56a9d9a7f2441d32930a0da47ea6084 100644 (file)
@@ -133,6 +133,7 @@ vector W_Crylink_LinkJoin(entity e, float jspeed, float jtime)
                        p.velocity = WarpZone_RefSys_TransformVelocity(e, p, avg_velocity);
                        UpdateCSQCProjectile(p);
                }
+               targ_origin = avg_origin + 1000000000 * normalize(avg_velocity); // HUUUUUUGE
        }
        else
        {
@@ -335,8 +336,8 @@ void W_Crylink_Attack (void)
 
        shots = autocvar_g_balance_crylink_primary_shots;
        pointparticles(particleeffectnum("crylink_muzzleflash"), w_shotorg, w_shotdir * 1000, shots);
-       proj = world;
-       while (counter < shots)
+       proj = prevproj = firstproj = world;
+       for(counter = 0; counter < shots; ++counter)
        {
                proj = spawn ();
                proj.reset = W_Crylink_Reset;
@@ -412,8 +413,6 @@ void W_Crylink_Attack (void)
                CSQCProjectile(proj, TRUE, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), TRUE);
 
                other = proj; MUTATOR_CALLHOOK(EditProjectile);
-
-               counter = counter + 1;
        }
        if(autocvar_g_balance_crylink_primary_joinspread != 0 || autocvar_g_balance_crylink_primary_jointime != 0)
        {
@@ -440,8 +439,8 @@ void W_Crylink_Attack2 (void)
 
        shots = autocvar_g_balance_crylink_secondary_shots;
        pointparticles(particleeffectnum("crylink_muzzleflash"), w_shotorg, w_shotdir * 1000, shots);
-       proj = world;
-       while (counter < shots)
+       proj = prevproj = firstproj = world;
+       for(counter = 0; counter < shots; ++counter)
        {
                proj = spawn ();
                proj.reset = W_Crylink_Reset;
@@ -505,8 +504,6 @@ void W_Crylink_Attack2 (void)
                CSQCProjectile(proj, TRUE, (proj.cnt ? PROJECTILE_CRYLINK_BOUNCING : PROJECTILE_CRYLINK), TRUE);
 
                other = proj; MUTATOR_CALLHOOK(EditProjectile);
-
-               counter = counter + 1;
        }
        if(autocvar_g_balance_crylink_secondary_joinspread != 0 || autocvar_g_balance_crylink_secondary_jointime != 0)
        {
index 76103f347e34fa50c6d16c849f6ee0dc0c15f2ac..f3a200f1ca230d9b016e07e2803cea15dbf5310e 100644 (file)
@@ -174,7 +174,7 @@ void W_Hagar_Attack2_Load_Release (void)
 
        shots = self.hagar_load;
        missile = world;
-       while (counter < shots)
+       for(counter = 0; counter < shots; ++counter)
        {
                missile = spawn ();
                missile.owner = missile.realowner = self;
@@ -223,8 +223,6 @@ void W_Hagar_Attack2_Load_Release (void)
                CSQCProjectile(missile, TRUE, PROJECTILE_HAGAR, TRUE);
 
                other = missile; MUTATOR_CALLHOOK(EditProjectile);
-
-               counter = counter + 1;
        }
 
        weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_hagar_secondary_load_animtime, w_ready);
index 0e73ba71763d0c63dd8d476cf0e671f56142264a..5bf98d7524ab256e33d1a73938088ec887a2f38f 100644 (file)
@@ -149,7 +149,7 @@ void W_Mine_ProximityExplode ()
 
 float W_Mine_Count(entity e)
 {
-       float minecount;
+       float minecount = 0;
        entity mine;
        for(mine = world; (mine = find(mine, classname, "mine")); ) if(mine.realowner == e)
                minecount += 1;
@@ -328,7 +328,7 @@ void W_Mine_Attack (void)
 float W_PlacedMines(float detonate)
 {
        entity mine;
-       float minfound;
+       float minfound = 0;
 
        for(mine = world; (mine = find(mine, classname, "mine")); ) if(mine.realowner == self)
        {
index f09f25bdcd13d320e5b9277da55795865d5c3e88..7bbebdc9c2a707ad0cd5366d2f1de44456db6838 100644 (file)
@@ -334,6 +334,7 @@ void WarpZone_TraceToss_ThroughZone(entity e, entity forent, entity zone, WarpZo
 
        o0 = e.origin;
        v0 = e.velocity;
+       g = cvar("sv_gravity") * e.gravity;
 
        WarpZone_trace_forent = forent;
        WarpZone_trace_firstzone = world;
@@ -376,7 +377,6 @@ void WarpZone_TraceToss_ThroughZone(entity e, entity forent, entity zone, WarpZo
                e.velocity = WarpZone_TransformVelocity(wz, e.velocity);
        }
        WarpZone_MakeAllSolid();
-       g = cvar("sv_gravity") * e.gravity;
        i = 16;
        for(;;)
        {
index 89c4b72b5f59b15df29024fa07507a3de314d40b..9b94640b5a2319c734a103db57e036b48dd26883 100644 (file)
@@ -259,7 +259,7 @@ float WarpZone_Send(entity to, float sendflags)
 
 float WarpZone_Camera_Send(entity to, float sendflags)
 {
-       float f;
+       float f = 0;
        WriteByte(MSG_ENTITY, ENT_CLIENT_WARPZONE_CAMERA);
 
        if(self.warpzone_fadestart)