]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into divVerent/urllib-weaponstats
authorRudolf Polzer <divVerent@xonotic.org>
Thu, 18 Aug 2011 19:00:42 +0000 (21:00 +0200)
committerRudolf Polzer <divVerent@xonotic.org>
Thu, 18 Aug 2011 19:00:42 +0000 (21:00 +0200)
qcsrc/server/bot/aim.qc
qcsrc/server/bot/havocbot/havocbot.qc
qcsrc/server/g_world.qc
qcsrc/server/w_rifle.qc
qcsrc/server/w_shotgun.qc

index 699748fdae58401b0fe3d9002977e88ac17f7993..b678bf1b660de2a9920d29ebc5e8af7a2ef554ab 100644 (file)
@@ -320,7 +320,7 @@ vector bot_shotlead(vector targorigin, vector targvelocity, float shotspeed, flo
 
 float bot_aim(float shotspeed, float shotspeedupward, float maxshottime, float applygravity)
 {
-       local float f, r;
+       local float f, r, hf, distanceratio;
        local vector v;
        /*
        eprint(self);
@@ -330,6 +330,10 @@ float bot_aim(float shotspeed, float shotspeedupward, float maxshottime, float a
        dprint(", ", ftos(applygravity));
        dprint(");\n");
        */
+
+       hf = self.dphitcontentsmask;
+       self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
+
        shotspeed *= g_weaponspeedfactor;
        shotspeedupward *= g_weaponspeedfactor;
        if (!shotspeed)
@@ -346,15 +350,18 @@ float bot_aim(float shotspeed, float shotspeedupward, float maxshottime, float a
        shotorg = self.origin + self.view_ofs;
        shotdir = v_forward;
        v = bot_shotlead(self.bot_aimtargorigin, self.bot_aimtargvelocity, shotspeed, self.bot_aimlatency);
-       local float distanceratio;
-       distanceratio =sqrt(bound(0,skill,10000))*0.3*(vlen(v-shotorg)-100)/autocvar_bot_ai_aimskill_firetolerance_distdegrees;
+       distanceratio = sqrt(bound(0,skill,10000))*0.3*(vlen(v-shotorg)-100)/autocvar_bot_ai_aimskill_firetolerance_distdegrees;
        distanceratio = bound(0,distanceratio,1);
        r =  (autocvar_bot_ai_aimskill_firetolerance_maxdegrees-autocvar_bot_ai_aimskill_firetolerance_mindegrees)
                * (1-distanceratio) + autocvar_bot_ai_aimskill_firetolerance_mindegrees;
        if (applygravity && self.bot_aimtarg)
        {
                if (!findtrajectorywithleading(shotorg, '0 0 0', '0 0 0', self.bot_aimtarg, shotspeed, shotspeedupward, maxshottime, 0, self))
+               {
+                       self.dphitcontentsmask = hf;
                        return FALSE;
+               }
+
                f = bot_aimdir(findtrajectory_velocity - shotspeedupward * '0 0 1', r);
        }
        else
@@ -370,10 +377,14 @@ float bot_aim(float shotspeed, float shotspeedupward, float maxshottime, float a
                if (trace_fraction < 1)
                if (trace_ent != self.enemy)
                if (!bot_shouldattack(trace_ent))
+               {
+                       self.dphitcontentsmask = hf;
                        return FALSE;
+               }
        }
 
        //if (r > maxshottime * shotspeed)
        //      return FALSE;
+       self.dphitcontentsmask = hf;
        return TRUE;
 };
index 79f305a2673af51b9cfe7cfe6326ebe2035d683d..113d318506b456d478aa3b7ab62701ba0347cb05 100644 (file)
@@ -489,7 +489,7 @@ void havocbot_movetogoal()
        // Handling of jump pads
        if(self.jumppadcount)
        {
-               // If got stuck on the jump pad try to reach the farthest visible item
+               // If got stuck on the jump pad try to reach the farthest visible waypoint
                if(self.aistatus & AI_STATUS_OUT_JUMPPAD)
                {
                        if(fabs(self.velocity_z)<50)
@@ -497,10 +497,8 @@ void havocbot_movetogoal()
                                local entity head, newgoal;
                                local float distance, bestdistance;
 
-                               for (head = findchainfloat(bot_pickup, TRUE); head; head = head.chain)
+                               for (head = findchain(classname, "waypoint"); head; head = head.chain)
                                {
-                                       if(head.classname=="worldspawn")
-                                               continue;
 
                                        distance = vlen(head.origin - self.origin);
                                        if(distance>1000)
@@ -534,11 +532,13 @@ void havocbot_movetogoal()
                {
                        if(self.velocity_z>0)
                        {
-                               local float threshold;
+                               float threshold, sxy;
+                               vector velxy = self.velocity; velxy_z = 0;
+                               sxy = vlen(velxy);
                                threshold = maxspeed * 0.2;
-                               if(fabs(self.velocity_x) < threshold  &&  fabs(self.velocity_y) < threshold)
+                               if(sxy < threshold)
                                {
-                                       dprint("Warning: ", self.netname, " got stuck on a jumppad, trying to get out of it now\n");
+                                       dprint("Warning: ", self.netname, " got stuck on a jumppad (velocity in xy is ", ftos(sxy), "), trying to get out of it now\n");
                                        self.aistatus |= AI_STATUS_OUT_JUMPPAD;
                                }
                                return;
@@ -863,7 +863,7 @@ void havocbot_movetogoal()
 void havocbot_chooseenemy()
 {
        local entity head, best, head2;
-       local float rating, bestrating, i, f;
+       local float rating, bestrating, i, hf;
        local vector eye, v;
        if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(self))
        {
@@ -908,7 +908,13 @@ void havocbot_chooseenemy()
        bestrating = 100000000;
        head = head2 = findchainfloat(bot_attack, TRUE);
 
+       // Backup hit flags
+       hf = self.dphitcontentsmask;
+
        // Search for enemies, if no enemy can be seen directly try to look through transparent objects
+
+       self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
+
        for(;;)
        {
                while (head)
@@ -937,16 +943,14 @@ void havocbot_chooseenemy()
                        break;
 
                // Set flags to see through transparent objects
-               f = self.dphitcontentsmask;
-               self.dphitcontentsmask = DPCONTENTS_OPAQUE;
+               self.dphitcontentsmask |= DPCONTENTS_OPAQUE;
 
                head = head2;
                ++i;
        }
 
-       // Restore hit flags if needed
-       if(i)
-               self.dphitcontentsmask = f;
+       // Restore hit flags
+       self.dphitcontentsmask = hf;
 
        self.enemy = best;
        self.havocbot_stickenemy = TRUE;
index 2a8948c9987f9d8aa771e41b9a2b6a252b6bef7e..1ba0a54eba6451f324d5555a876c51985e00d086 100644 (file)
@@ -295,6 +295,7 @@ void cvar_changes_init()
                BADPREFIX("developer_");
                BADPREFIX("g_ban_");
                BADPREFIX("g_chat_flood_");
+               BADPREFIX("g_playerstats_");
                BADPREFIX("g_voice_flood_");
                BADPREFIX("rcon_");
                BADPREFIX("settemp_");
@@ -307,10 +308,7 @@ void cvar_changes_init()
                BADPREFIX("sv_weaponstats_");
 
                // these can contain player IDs, so better hide
-               BADCVAR("g_forced_team_red");
-               BADCVAR("g_forced_team_blue");
-               BADCVAR("g_forced_team_yellow");
-               BADCVAR("g_forced_team_pink");
+               BADPREFIX("g_forced_team_");
 
                // mapinfo
                BADCVAR("fraglimit");
@@ -418,6 +416,7 @@ void cvar_changes_init()
                BADCVAR("g_ctf_ignore_frags");
                BADCVAR("g_ctf_win_mode");
                BADCVAR("g_domination_point_limit");
+               BADCVAR("g_friendlyfire");
                BADCVAR("g_fullbrightitems");
                BADCVAR("g_fullbrightplayers");
                BADCVAR("g_keyhunt_point_limit");
@@ -431,15 +430,17 @@ void cvar_changes_init()
                BADCVAR("g_maplist_votable_abstain");
                BADCVAR("g_maplist_votable_nodetail");
                BADCVAR("g_maplist_votable_suggestions");
+               BADCVAR("g_maxplayers");
                BADCVAR("g_minstagib");
+               BADCVAR("g_mirrordamage");
                BADCVAR("g_nexball_goallimit");
                BADCVAR("g_runematch_point_limit");
                BADCVAR("g_start_delay");
+               BADCVAR("g_warmup");
                BADCVAR("g_weapon_stay"); BADPRESUFFIX("g_", "_weapon_stay");
                BADCVAR("hostname");
                BADCVAR("log_file");
                BADCVAR("maxplayers");
-               BADCVAR("g_maxplayers");
                BADCVAR("minplayers");
                BADCVAR("net_address");
                BADCVAR("port");
@@ -467,10 +468,10 @@ void cvar_changes_init()
                BADCVAR("sv_vote_master_commands");
                BADCVAR("sv_vote_master_password");
                BADCVAR("sv_vote_simple_majority_factor");
+               BADCVAR("sys_ticrate");
+               BADCVAR("teamplay_mode");
                BADCVAR("timelimit_override");
-               BADCVAR("g_warmup");
                BADPREFIX("g_warmup_");
-               BADCVAR("teamplay_mode");
 
                if(autocvar_g_minstagib)
                {
index d89d44571d113daff23598475bc780c6e9f0d47c..02d859e0fdf854c734e8739111a8bf19aa5558b2 100644 (file)
@@ -116,7 +116,7 @@ float w_rifle(float req)
                        self.bot_secondary_riflemooth = 0;
                if(self.bot_secondary_riflemooth == 0)
                {
-                       if(bot_aim(autocvar_g_balance_rifle_primary_speed, 0, autocvar_g_balance_rifle_primary_lifetime, TRUE))
+                       if(bot_aim(autocvar_g_balance_rifle_primary_speed, 0, autocvar_g_balance_rifle_primary_lifetime, FALSE))
                        {
                                self.BUTTON_ATCK = TRUE;
                                if(random() < 0.01) self.bot_secondary_riflemooth = 1;
@@ -124,7 +124,7 @@ float w_rifle(float req)
                }
                else
                {
-                       if(bot_aim(autocvar_g_balance_rifle_secondary_speed, 0, autocvar_g_balance_rifle_secondary_lifetime, TRUE))
+                       if(bot_aim(autocvar_g_balance_rifle_secondary_speed, 0, autocvar_g_balance_rifle_secondary_lifetime, FALSE))
                        {
                                self.BUTTON_ATCK2 = TRUE;
                                if(random() < 0.03) self.bot_secondary_riflemooth = 0;
@@ -147,7 +147,7 @@ float w_rifle(float req)
                                self.rifle_accumulator += autocvar_g_balance_rifle_primary_burstcost;
                        }
                        if (self.BUTTON_ATCK2)
-                       {       
+                       {
                                if (autocvar_g_balance_rifle_secondary)
                                {
                     if(autocvar_g_balance_rifle_secondary_reload)
index b77ed92252eb640d7131ac40431caf54dfc9458e..9d80ff4a7b88c2318c78e7468b4ce816d108e32f 100644 (file)
@@ -113,7 +113,13 @@ float w_shotgun(float req)
                if(vlen(self.origin-self.enemy.origin) <= autocvar_g_balance_shotgun_secondary_melee_range)
                        self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, FALSE);
                else
-                       self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE);
+               {
+                       if(autocvar_g_antilag_bullets)
+                               self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE);
+                       else
+                               self.BUTTON_ATCK = bot_aim(autocvar_g_balance_shotgun_primary_speed, 0, 0.001, FALSE);
+               }
+
        else if (req == WR_THINK)
        {
                if(autocvar_g_balance_shotgun_reload_ammo && self.clip_load < autocvar_g_balance_shotgun_primary_ammo) // forced reload