]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into Mario/wepent_experimental
authorMario <mario@smbclan.net>
Sat, 31 Dec 2016 05:44:54 +0000 (15:44 +1000)
committerMario <mario@smbclan.net>
Sat, 31 Dec 2016 05:44:54 +0000 (15:44 +1000)
# Conflicts:
# qcsrc/common/mutators/mutator/overkill/sv_overkill.qc
# qcsrc/common/turrets/turret/plasma.qc
# qcsrc/common/turrets/turret/plasma_dual.qc
# qcsrc/common/weapons/weapon/vaporizer.qc
# qcsrc/common/weapons/weapon/vortex.qc

44 files changed:
.gitlab-ci.yml
bal-wep-xonotic.cfg
bal-wep-xpm.cfg
defaultXonotic.cfg
gamemodes.cfg
qcsrc/client/view.qc
qcsrc/common/debug.qh
qcsrc/common/mutators/mutator/breakablehook/sv_breakablehook.qc
qcsrc/common/mutators/mutator/buffs/sv_buffs.qc
qcsrc/common/mutators/mutator/campcheck/sv_campcheck.qc
qcsrc/common/mutators/mutator/instagib/sv_instagib.qc
qcsrc/common/mutators/mutator/midair/sv_midair.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/overkill/sv_overkill.qc
qcsrc/common/mutators/mutator/rocketminsta/sv_rocketminsta.qc
qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc
qcsrc/common/turrets/sv_turrets.qc
qcsrc/common/turrets/turret/plasma.qc
qcsrc/common/turrets/turret/plasma_dual.qc
qcsrc/common/vehicles/vehicle/bumblebee.qc
qcsrc/common/vehicles/vehicle/raptor.qc
qcsrc/common/vehicles/vehicle/spiderbot.qc
qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc
qcsrc/common/weapons/weapon.qh
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/common/weapons/weapon/vortex.qc
qcsrc/lib/float.qh [new file with mode: 0644]
qcsrc/server/cheats.qc
qcsrc/server/command/sv_cmd.qc
qcsrc/server/command/sv_cmd.qh
qcsrc/server/g_damage.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/events.qh
qcsrc/server/mutators/mutator/gamemode_assault.qc
qcsrc/server/mutators/mutator/gamemode_ca.qc
qcsrc/server/mutators/mutator/gamemode_ctf.qc
qcsrc/server/mutators/mutator/gamemode_cts.qc
qcsrc/server/mutators/mutator/gamemode_invasion.qc
qcsrc/server/mutators/mutator/gamemode_keepaway.qc
qcsrc/server/player.qc
qcsrc/server/teamplay.qc
qcsrc/server/weapons/hitplot.qc
qcsrc/server/weapons/tracing.qc
qcsrc/server/weapons/tracing.qh

index 39414d108ae8b1b3d395537006c571182d4fd6cf..e3f2ccb7ab6fc22429359c6e7d65b7f1ba782f9b 100644 (file)
@@ -30,7 +30,7 @@ test_sv_game:
     - wget -O data/maps/g-23.waypoints.cache https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/g-23.waypoints.cache
     - wget -O data/maps/g-23.waypoints.hardwired https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/g-23.waypoints.hardwired
     - make
-    - EXPECT=37be9dc5489925451eb497390fdf58b9
+    - EXPECT=81f90da8c88646dcce300fdcc31113d1
     - HASH=$(${ENGINE} -noconfig -nohome +exec serverbench.cfg
       | tee /dev/stderr
       | grep '^:'
index 57b632be48c98ac1bfef777c1deb0773f4d8ab36..7d94daada4af71f79c84d616fbaaec9959e55d59 100644 (file)
@@ -1,8 +1,8 @@
 // {{{ #1: Blaster
 set g_balance_blaster_primary_animtime 0.2
-set g_balance_blaster_primary_damage 25
+set g_balance_blaster_primary_damage 20
 set g_balance_blaster_primary_delay 0
-set g_balance_blaster_primary_edgedamage 12.5
+set g_balance_blaster_primary_edgedamage 10
 set g_balance_blaster_primary_force 300
 set g_balance_blaster_primary_force_zscale 1.25
 set g_balance_blaster_primary_lifetime 5
@@ -75,7 +75,7 @@ set g_balance_machinegun_burst_speed 0
 set g_balance_machinegun_first 1
 set g_balance_machinegun_first_ammo 1
 set g_balance_machinegun_first_damage 14
-set g_balance_machinegun_first_force 5
+set g_balance_machinegun_first_force 3
 set g_balance_machinegun_first_refire 0.125
 set g_balance_machinegun_first_spread 0.03
 set g_balance_machinegun_mode 1
@@ -87,7 +87,7 @@ set g_balance_machinegun_spread_max 0.05
 set g_balance_machinegun_spread_min 0.02
 set g_balance_machinegun_sustained_ammo 1
 set g_balance_machinegun_sustained_damage 10
-set g_balance_machinegun_sustained_force 5
+set g_balance_machinegun_sustained_force 3
 set g_balance_machinegun_sustained_refire 0.1
 set g_balance_machinegun_sustained_spread 0.03
 set g_balance_machinegun_switchdelay_drop 0.2
@@ -233,8 +233,8 @@ set g_balance_crylink_primary_ammo 3
 set g_balance_crylink_primary_animtime 0.3
 set g_balance_crylink_primary_bouncedamagefactor 0.5
 set g_balance_crylink_primary_bounces 1
-set g_balance_crylink_primary_damage 12
-set g_balance_crylink_primary_edgedamage 6
+set g_balance_crylink_primary_damage 10
+set g_balance_crylink_primary_edgedamage 5
 set g_balance_crylink_primary_force -50
 set g_balance_crylink_primary_joindelay 0.1
 set g_balance_crylink_primary_joinexplode 1
@@ -260,9 +260,9 @@ set g_balance_crylink_secondary_ammo 2
 set g_balance_crylink_secondary_animtime 0.2
 set g_balance_crylink_secondary_bouncedamagefactor 0.5
 set g_balance_crylink_secondary_bounces 0
-set g_balance_crylink_secondary_damage 10
-set g_balance_crylink_secondary_edgedamage 5
-set g_balance_crylink_secondary_force -250
+set g_balance_crylink_secondary_damage 8
+set g_balance_crylink_secondary_edgedamage 4
+set g_balance_crylink_secondary_force -200
 set g_balance_crylink_secondary_joindelay 0
 set g_balance_crylink_secondary_joinexplode 0
 set g_balance_crylink_secondary_joinexplode_damage 0
index 57b632be48c98ac1bfef777c1deb0773f4d8ab36..7d94daada4af71f79c84d616fbaaec9959e55d59 100644 (file)
@@ -1,8 +1,8 @@
 // {{{ #1: Blaster
 set g_balance_blaster_primary_animtime 0.2
-set g_balance_blaster_primary_damage 25
+set g_balance_blaster_primary_damage 20
 set g_balance_blaster_primary_delay 0
-set g_balance_blaster_primary_edgedamage 12.5
+set g_balance_blaster_primary_edgedamage 10
 set g_balance_blaster_primary_force 300
 set g_balance_blaster_primary_force_zscale 1.25
 set g_balance_blaster_primary_lifetime 5
@@ -75,7 +75,7 @@ set g_balance_machinegun_burst_speed 0
 set g_balance_machinegun_first 1
 set g_balance_machinegun_first_ammo 1
 set g_balance_machinegun_first_damage 14
-set g_balance_machinegun_first_force 5
+set g_balance_machinegun_first_force 3
 set g_balance_machinegun_first_refire 0.125
 set g_balance_machinegun_first_spread 0.03
 set g_balance_machinegun_mode 1
@@ -87,7 +87,7 @@ set g_balance_machinegun_spread_max 0.05
 set g_balance_machinegun_spread_min 0.02
 set g_balance_machinegun_sustained_ammo 1
 set g_balance_machinegun_sustained_damage 10
-set g_balance_machinegun_sustained_force 5
+set g_balance_machinegun_sustained_force 3
 set g_balance_machinegun_sustained_refire 0.1
 set g_balance_machinegun_sustained_spread 0.03
 set g_balance_machinegun_switchdelay_drop 0.2
@@ -233,8 +233,8 @@ set g_balance_crylink_primary_ammo 3
 set g_balance_crylink_primary_animtime 0.3
 set g_balance_crylink_primary_bouncedamagefactor 0.5
 set g_balance_crylink_primary_bounces 1
-set g_balance_crylink_primary_damage 12
-set g_balance_crylink_primary_edgedamage 6
+set g_balance_crylink_primary_damage 10
+set g_balance_crylink_primary_edgedamage 5
 set g_balance_crylink_primary_force -50
 set g_balance_crylink_primary_joindelay 0.1
 set g_balance_crylink_primary_joinexplode 1
@@ -260,9 +260,9 @@ set g_balance_crylink_secondary_ammo 2
 set g_balance_crylink_secondary_animtime 0.2
 set g_balance_crylink_secondary_bouncedamagefactor 0.5
 set g_balance_crylink_secondary_bounces 0
-set g_balance_crylink_secondary_damage 10
-set g_balance_crylink_secondary_edgedamage 5
-set g_balance_crylink_secondary_force -250
+set g_balance_crylink_secondary_damage 8
+set g_balance_crylink_secondary_edgedamage 4
+set g_balance_crylink_secondary_force -200
 set g_balance_crylink_secondary_joindelay 0
 set g_balance_crylink_secondary_joinexplode 0
 set g_balance_crylink_secondary_joinexplode_damage 0
index ac3b51613967c33f4c98dbd64d0869c6530bf89e..9d3bea88c1f2fa7aee68e0c4efd8b622e6dab1b4 100644 (file)
@@ -1072,7 +1072,7 @@ alias gl_flashblend_update "_gl_flashblend_update_$r_shadow_realtime_dlight$r_sh
 
 set sv_clones 0        "number of clones a player may make (reset by the \"kill\" command)"
 
-set cl_handicap 1      "the higher, the more damage you will receive (client setting) NOTE: reconnect or use sendcvar command to update the choice."
+set cl_handicap 1      "multiplies damage received and divides damage dealt NOTE: reconnect or use 'sendcvar cl_handicap' to update the choice."
 
 seta cl_clippedspectating 1 "movement collision for spectators so that you can't pass through walls and such. (client setting) NOTE: reconnect or use sendcvar command to update the choice."
 
index 71f0dc1792200bea112c846ba847e47c7526bf29..630eb7a85d7bfee6e2eee10725c8299d0297f925 100644 (file)
@@ -18,7 +18,7 @@ alias asay_drop "say_team (%l) dropped %w ; impulse 17"
 // =================
 //  gamestart hooks
 // =================
-seta cl_matchcount 0 // incremented by cl_hook_gameend and used by playerstats to know when to 
+seta cl_matchcount 0 // incremented by cl_hook_gameend and used by playerstats to know when to
 alias _cl_hook_gamestart "set _cl_hook_gametype $1; _cl_hook_gamestart_stage2"
 alias _cl_hook_gamestart_stage2 "cl_hook_gamestart_all; cl_hook_gamestart_${_cl_hook_gametype}"
 alias cl_hook_gamestart_all
@@ -278,7 +278,7 @@ set g_ctf_dropped_capture_delay 1 "dropped capture delay"
 set g_ctf_dropped_capture_radius 100 "allow dropped flags to be automatically captured by base flags if the dropped flag is within this radius of it"
 set g_ctf_flag_damageforcescale 2
 set g_ctf_portalteleport 0 "allow flag carriers to go through portals made in portal gun without dropping the flag"
-set g_ctf_reverse 0 "if enabled, flags positions are switched: you have to capture the enemy's flag from your own base by bringing it to your own flag in the enemy base"
+set g_ctf_reverse 0 "if enabled, you score by bringing your own flag to an enemy's flag in their base"
 set g_ctf_flag_collect_delay 1
 set g_ctf_flag_health 0
 set g_ctf_flag_dropped_waypoint 2 "show dropped flag waypointsprite when a flag is lost. 1 = team only, 2 = for all players"
index 28160224ae2d6b70239a01ddd7cdb754a570fa5b..62783112ed1fca3c7260d0aa8db3c295936014da 100644 (file)
@@ -666,7 +666,7 @@ float TrueAimCheck(entity wepent)
                        mv = MOVE_NORMAL;
                        if(zoomscript_caught)
                        {
-                               tracebox(view_origin, '0 0 0', '0 0 0', view_origin + view_forward * MAX_SHOT_DISTANCE, mv, ta);
+                               tracebox(view_origin, '0 0 0', '0 0 0', view_origin + view_forward * max_shot_distance, mv, ta);
                                return EnemyHitCheck();
                        }
                        break;
@@ -692,7 +692,7 @@ float TrueAimCheck(entity wepent)
 
        vecs = decompressShotOrigin(STAT(SHOTORG));
 
-       traceline(traceorigin, traceorigin + view_forward * MAX_SHOT_DISTANCE, mv, ta);
+       traceline(traceorigin, traceorigin + view_forward * max_shot_distance, mv, ta);
        trueaimpoint = trace_endpos;
 
        if(vdist((trueaimpoint - traceorigin), <, g_trueaim_minrange))
@@ -993,7 +993,7 @@ void HUD_Crosshair(entity this)
                float shottype;
 
                // wcross_origin = '0.5 0 0' * vid_conwidth + '0 0.5 0' * vid_conheight;
-               wcross_origin = project_3d_to_2d(view_origin + MAX_SHOT_DISTANCE * view_forward);
+               wcross_origin = project_3d_to_2d(view_origin + max_shot_distance * view_forward);
                wcross_origin.z = 0;
                if(autocvar_crosshair_hittest)
                {
index 6d580bd2d69a8b65631a465d0adee730e6bca07d..10a69a70685ebdfdc79c481295410179215fe40d 100644 (file)
@@ -280,7 +280,7 @@ MUTATOR_HOOKFUNCTION(trace, SV_StartFrame)
                vector forward = '0 0 0'; vector right = '0 0 0'; vector up = '0 0 0';
                MAKEVECTORS(makevectors, it.v_angle, forward, right, up);
                vector pos = it.origin + it.view_ofs;
-               traceline(pos, pos + forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, it);
+               traceline(pos, pos + forward * max_shot_distance, MOVE_NORMAL, it);
                FOREACH_ENTITY(true, {
                    it.solid = it.solid_prev;
             it.solid_prev = 0;
index dfde6ed73b163be7c5bc3c30027d87b47f206793..ee1ca94b50dbecc85afa67911041d18d72356d9f 100644 (file)
@@ -8,7 +8,7 @@ REGISTER_MUTATOR(breakablehook, cvar("g_breakablehook"));
 bool autocvar_g_breakablehook; // allow toggling mid match?
 bool autocvar_g_breakablehook_owner;
 
-MUTATOR_HOOKFUNCTION(breakablehook, PlayerDamage_Calculate)
+MUTATOR_HOOKFUNCTION(breakablehook, Damage_Calculate)
 {
        entity frag_attacker = M_ARGV(1, entity);
        entity frag_target = M_ARGV(2, entity);
index 3bf73bf101364748169fef6c39303a0cda392ba2..36f34af53c39f49e441bf8a929980da7d42f72dc 100644 (file)
@@ -450,7 +450,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerDamage_SplitHealthArmor)
        }
 }
 
-MUTATOR_HOOKFUNCTION(buffs, PlayerDamage_Calculate)
+MUTATOR_HOOKFUNCTION(buffs, Damage_Calculate)
 {
        entity frag_attacker = M_ARGV(1, entity);
        entity frag_target = M_ARGV(2, entity);
index c4d2e030267114b46cba723d8322a614a0d8de26..36da631bb360cbb24f19a3d156eaffcf33a0eb4c 100644 (file)
@@ -16,7 +16,7 @@ MUTATOR_HOOKFUNCTION(campcheck, PlayerDies)
        Kill_Notification(NOTIF_ONE, frag_target, MSG_CENTER, CPID_CAMPCHECK);
 }
 
-MUTATOR_HOOKFUNCTION(campcheck, PlayerDamage_Calculate)
+MUTATOR_HOOKFUNCTION(campcheck, Damage_Calculate)
 {
        entity frag_attacker = M_ARGV(1, entity);
        entity frag_target = M_ARGV(2, entity);
index 4c6dc15a3c0bff02b9dcaa75435e5789b2c9673f..88bb8c0d997b592c60c154684744ec51f089c484 100644 (file)
@@ -257,7 +257,7 @@ MUTATOR_HOOKFUNCTION(mutator_instagib, ForbidThrowCurrentWeapon)
        return true;
 }
 
-MUTATOR_HOOKFUNCTION(mutator_instagib, PlayerDamage_Calculate)
+MUTATOR_HOOKFUNCTION(mutator_instagib, Damage_Calculate)
 {
        entity frag_attacker = M_ARGV(1, entity);
        entity frag_target = M_ARGV(2, entity);
index 40747ff0569b08a69ec0580027c7b38f3abdd1b3..92bbacc00663c2eb70d50dda92b913874eb2493d 100644 (file)
@@ -6,7 +6,7 @@ REGISTER_MUTATOR(midair, cvar("g_midair"));
 
 .float midair_shieldtime;
 
-MUTATOR_HOOKFUNCTION(midair, PlayerDamage_Calculate)
+MUTATOR_HOOKFUNCTION(midair, Damage_Calculate)
 {
        entity frag_attacker = M_ARGV(1, entity);
        entity frag_target = M_ARGV(2, entity);
index 7f2bed6973aafcdd50327c74e9a5d8b6b266267a..5bf0360fdb74c8c6d0dd72c4a20b1ebc361134cb 100644 (file)
@@ -1403,7 +1403,7 @@ MUTATOR_HOOKFUNCTION(nades, PlayerDies, CBC_ORDER_LAST)
        nades_RemoveBonus(frag_target);
 }
 
-MUTATOR_HOOKFUNCTION(nades, PlayerDamage_Calculate)
+MUTATOR_HOOKFUNCTION(nades, Damage_Calculate)
 {
        entity frag_inflictor = M_ARGV(0, entity);
        entity frag_attacker = M_ARGV(1, entity);
index 9bc39781bace277a70743819d32dda4440b089ac..ba2d98f49a5b011a8e30c664df333083e1b581c9 100644 (file)
@@ -34,18 +34,17 @@ void W_Blaster_Attack(entity, .entity, float, float, float, float, float, float,
 spawnfunc(weapon_hmg);
 spawnfunc(weapon_rpc);
 
-MUTATOR_HOOKFUNCTION(ok, PlayerDamage_Calculate, CBC_ORDER_LAST)
+MUTATOR_HOOKFUNCTION(ok, Damage_Calculate, CBC_ORDER_LAST)
 {
        entity frag_attacker = M_ARGV(1, entity);
        entity frag_target = M_ARGV(2, entity);
        float frag_deathtype = M_ARGV(3, float);
 
-       if(IS_PLAYER(frag_attacker) && IS_PLAYER(frag_target))
+       if(IS_PLAYER(frag_attacker) && (IS_PLAYER(frag_target) || IS_VEHICLE(frag_target) || IS_TURRET(frag_target)))
        if(DEATH_ISWEAPON(frag_deathtype, WEP_BLASTER))
        {
                if(frag_attacker != frag_target)
-               if(frag_target.health > 0)
-               if(STAT(FROZEN, frag_target) == 0)
+               if(!STAT(FROZEN, frag_target))
                if(!IS_DEAD(frag_target))
                {
                        Send_Notification(NOTIF_ONE, frag_attacker, MSG_CENTER, CENTER_SECONDARY_NODAMAGE);
@@ -214,8 +213,7 @@ MUTATOR_HOOKFUNCTION(ok, OnEntityPreSpawn)
                        wep.nextthink = time + 0.1;
                        return true;
                }
-
-               if(ent.classname == "item_invincible")
+               else if(ent.classname == "item_invincible")
                {
                        entity wep = new(weapon_rpc);
                        setorigin(wep, ent.origin);
index 04d8099e0230aacf2f4988ac4a93d4b5a89709b6..7edef9813de0fd3c13ca1d79d6593674202c32c1 100644 (file)
@@ -5,7 +5,7 @@
 
 REGISTER_MUTATOR(rm, cvar("g_instagib"));
 
-MUTATOR_HOOKFUNCTION(rm, PlayerDamage_Calculate)
+MUTATOR_HOOKFUNCTION(rm, Damage_Calculate)
 {
        // we do it this way, so rm can be toggled during the match
        if(!autocvar_g_rm) { return; }
index a0017f94df23dd9a10fabc590af2f856ca074a42..ee75728630e2e5623f988e1d7efaf7b31d9f37d7 100644 (file)
@@ -1,6 +1,6 @@
 #include "sv_spawn_near_teammate.qh"
 
-const float FLOAT_MAX = 340282346638528859811704183484516925440.0f;
+#include <lib/float.qh>
 
 float autocvar_g_spawn_near_teammate_distance;
 int autocvar_g_spawn_near_teammate_ignore_spawnpoint;
index c90eaff1fe98fdb22bc7918fefedd1f28c703738..83db075b422a7efe3f75dd1bab2a9220102d8060 100644 (file)
@@ -1224,13 +1224,13 @@ void turret_initparams(entity tur)
        tur.shot_force                  = bound(0.001,           (TRY(tur.shot_force)                :  tur.shot_dmg * 0.5 + tur.shot_radius * 0.5 ), 5000);
        tur.shot_volly                  = bound(1,               (TRY(tur.shot_volly)                :  1                                          ), floor(tur.ammo_max / tur.shot_dmg));
        tur.shot_volly_refire           = bound(tur.shot_refire, (TRY(tur.shot_volly_refire)         :  tur.shot_refire * tur.shot_volly           ), 60);
-       tur.target_range                = bound(0,               (TRY(tur.target_range)              :  tur.shot_speed * 0.5                       ), MAX_SHOT_DISTANCE);
-       tur.target_range_min            = bound(0,               (TRY(tur.target_range_min)          :  tur.shot_radius * 2                        ), MAX_SHOT_DISTANCE);
-       tur.target_range_optimal        = bound(0,               (TRY(tur.target_range_optimal)      :  tur.target_range * 0.5                     ), MAX_SHOT_DISTANCE);
+       tur.target_range                = bound(0,               (TRY(tur.target_range)              :  tur.shot_speed * 0.5                       ), max_shot_distance);
+       tur.target_range_min            = bound(0,               (TRY(tur.target_range_min)          :  tur.shot_radius * 2                        ), max_shot_distance);
+       tur.target_range_optimal        = bound(0,               (TRY(tur.target_range_optimal)      :  tur.target_range * 0.5                     ), max_shot_distance);
        tur.aim_maxrotate               = bound(0,               (TRY(tur.aim_maxrotate)             :  90                                         ), 360);
        tur.aim_maxpitch                = bound(0,               (TRY(tur.aim_maxpitch)              :  20                                         ), 90);
        tur.aim_speed                   = bound(0.1,             (TRY(tur.aim_speed)                 :  36                                         ), 1000);
-       tur.aim_firetolerance_dist      = bound(0.1,             (TRY(tur.aim_firetolerance_dist)    :  5 + (tur.shot_radius * 2)                  ), MAX_SHOT_DISTANCE);
+       tur.aim_firetolerance_dist      = bound(0.1,             (TRY(tur.aim_firetolerance_dist)    :  5 + (tur.shot_radius * 2)                  ), max_shot_distance);
        tur.target_select_rangebias     = bound(-10,             (TRY(tur.target_select_rangebias)   :  1                                          ), 10);
        tur.target_select_samebias      = bound(-10,             (TRY(tur.target_select_samebias)    :  1                                          ), 10);
        tur.target_select_anglebias     = bound(-10,             (TRY(tur.target_select_anglebias)   :  1                                          ), 10);
@@ -1270,7 +1270,7 @@ bool turret_initialize(entity this, Turret tur)
        this.netname = tur.netname;
        load_unit_settings(this, 0);
 
-       if(!this.team || !teamplay)             { this.team = MAX_SHOT_DISTANCE; }
+       if(!this.team || !teamplay)             { this.team = FLOAT_MAX; }
        if(!this.ticrate)                               { this.ticrate = ((this.turret_flags & TUR_FLAG_SUPPORT) ? 0.2 : 0.1); }
        if(!this.health)                                { this.health = 1000; }
        if(!this.shot_refire)                   { this.shot_refire = 1; }
index ed7d4f16088636f71bce125bda130dea77be921a..7317930c9005001578140ceb2233352393215ee4 100644 (file)
@@ -11,7 +11,7 @@ METHOD(PlasmaTurret, tr_attack, void(PlasmaTurret this, entity it))
     if(g_instagib)
     {
         .entity weaponentity = weaponentities[0]; // TODO: unhardcode
-        FireRailgunBullet (it, weaponentity, it.tur_shotorg, it.tur_shotorg + it.tur_shotdir_updated * MAX_SHOT_DISTANCE, 10000000000,
+        FireRailgunBullet (it, weaponentity, it.tur_shotorg, it.tur_shotorg + it.tur_shotdir_updated * max_shot_distance, 10000000000,
                            800, 0, 0, 0, 0, DEATH_TURRET_PLASMA.m_id);
 
         Send_Effect(EFFECT_VORTEX_MUZZLEFLASH, it.tur_shotorg, it.tur_shotdir_updated * 1000, 1);
index b1e7d5850aa08416e77ed650418234dc4eace550..3efe969f31afe79d73702e014c770032ac59bc86 100644 (file)
@@ -10,7 +10,7 @@ METHOD(DualPlasmaTurret, tr_attack, void(DualPlasmaTurret thistur, entity it))
 {
     if (g_instagib) {
         .entity weaponentity = weaponentities[0]; // TODO: unhardcode
-        FireRailgunBullet (it, weaponentity, it.tur_shotorg, it.tur_shotorg + it.tur_shotdir_updated * MAX_SHOT_DISTANCE, 10000000000,
+        FireRailgunBullet (it, weaponentity, it.tur_shotorg, it.tur_shotorg + it.tur_shotdir_updated * max_shot_distance, 10000000000,
                            800, 0, 0, 0, 0, DEATH_TURRET_PLASMA.m_id);
 
 
index 564e7b60efee5ca250111c202c2511e3e2f4c961..a4f4beca614d0ee791f6ea1e91bdcd0d21006865 100644 (file)
@@ -167,7 +167,7 @@ bool bumblebee_gunner_frame(entity this, float dt)
                VEHICLE_UPDATE_PLAYER(this, vehic, shield, bumblebee);
 
        ad = gettaginfo(gun, gettagindex(gun, "fire"));
-       traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, gun);
+       traceline(ad, ad + v_forward * max_shot_distance, MOVE_NORMAL, gun);
 
        UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' *(1 - this.vehicle_reload1)), 0);
 
index 5dbd4f4ccb8adc8726f6022949e83348d1fe3305..2b349e11db949724ba2024f9ef302136a64128cf 100644 (file)
@@ -351,7 +351,7 @@ bool raptor_frame(entity this, float dt)
        /*
        ad = ad * 0.5;
        v_forward = vf * 0.5;
-       traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic);
+       traceline(ad, ad + v_forward * max_shot_distance, MOVE_NORMAL, vehic);
        UpdateAuxiliaryXhair(this, trace_endpos, '0 1 0', 0);
        */
 
index 60a56944ab19b05678b0b6c28ea110cf001066ed..ccc509c6bca9f7f2c5b76933ae6d408f487c78a1 100644 (file)
@@ -76,15 +76,15 @@ bool spiderbot_frame(entity this, float dt)
        vf += v_forward;
        ad = ad * 0.5;
        v_forward = vf * 0.5;
-       traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic);
+       traceline(ad, ad + v_forward * max_shot_distance, MOVE_NORMAL, vehic);
        UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' * (1 - this.vehicle_reload1)), 0);
 #else
        vector ad = gettaginfo(vehic.gun1, gettagindex(vehic.gun1, "barrels"));
-       traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic);
+       traceline(ad, ad + v_forward * max_shot_distance, MOVE_NORMAL, vehic);
        UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' * (1 - this.vehicle_reload1)), 0);
        vector vf = ad;
        ad = gettaginfo(vehic.gun2, gettagindex(vehic.gun2, "barrels"));
-       traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic);
+       traceline(ad, ad + v_forward * max_shot_distance, MOVE_NORMAL, vehic);
        UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' * (1 - this.vehicle_reload1)), 1);
        ad = 0.5 * (ad + vf);
 #endif
index 5f7a2c31c8a928cbbc5efec1d99e869a0c01a6fc..1fde99b3fcc48e87014fa84f57e1d1a0d11bd9b2 100644 (file)
@@ -221,11 +221,11 @@ void spiderbot_rocket_do(entity this)
             rocket.pos1           = trace_endpos + randomvec() * (0.75 * autocvar_g_vehicle_spiderbot_rocket_radius);
             rocket.pos1_z         = trace_endpos_z;
 
-            traceline(v, v + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, this);
+            traceline(v, v + '0 0 1' * max_shot_distance, MOVE_WORLDONLY, this);
             float h1 = 0.75 * vlen(v - trace_endpos);
 
             //v = trace_endpos;
-            traceline(v , rocket.pos1 + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, this);
+            traceline(v , rocket.pos1 + '0 0 1' * max_shot_distance, MOVE_WORLDONLY, this);
             float h2 = 0.75 * vlen(rocket.pos1 - v);
 
             rocket.velocity  = spiberbot_calcartillery(v, rocket.pos1, ((h1 < h2) ? h1 : h2));
index c873f4463302337faf73b3e29ddbba2471b9bf15..6ccfcae57c18ef92a1b76afab2ffb0d3e8131971 100644 (file)
@@ -177,7 +177,9 @@ ENDCLASS(OffhandWeapon)
 .OffhandWeapon offhand;
 #endif
 
-const int MAX_SHOT_DISTANCE = 32768;
+#ifdef GAMEQC
+int max_shot_distance = 32768; // determined by world mins/maxs when map loads
+#endif
 
 // weapon flags
 const int WEP_TYPE_OTHER          =  0x00; // not for damaging people
index 4e352c75d9452188e4a8012a171ad541adad757e..3e2575838b8b19ef64c081f01d18df4947ee1a58 100644 (file)
@@ -194,7 +194,7 @@ void W_Vaporizer_Attack(Weapon thiswep, entity actor, .entity weaponentity)
 
        yoda = 0;
        damage_goodhits = 0;
-       FireRailgunBullet(actor, weaponentity, w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, vaporizer_damage, 800, 0, 0, 0, 0, WEP_VAPORIZER.m_id);
+       FireRailgunBullet(actor, weaponentity, w_shotorg, w_shotorg + w_shotdir * max_shot_distance, vaporizer_damage, 800, 0, 0, 0, 0, WEP_VAPORIZER.m_id);
 
        // do this now, as goodhits is disabled below
        SendCSQCVaporizerBeamParticle(actor, damage_goodhits);
index b3ba65c5056eba74be4d85dcde6874eff9e2a885..34d9fb8dd8e924842cd357a4e3990dc5386219ca 100644 (file)
@@ -202,7 +202,7 @@ void W_Vortex_Attack(Weapon thiswep, entity actor, .entity weaponentity, float i
 
        yoda = 0;
        damage_goodhits = 0;
-       FireRailgunBullet(actor, weaponentity, w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, WEP_VORTEX.m_id);
+       FireRailgunBullet(actor, weaponentity, w_shotorg, w_shotorg + w_shotdir * max_shot_distance, mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, WEP_VORTEX.m_id);
 
        if(yoda && flying)
                Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
diff --git a/qcsrc/lib/float.qh b/qcsrc/lib/float.qh
new file mode 100644 (file)
index 0000000..946319e
--- /dev/null
@@ -0,0 +1,3 @@
+#pragma once
+
+const float FLOAT_MAX = 340282346638528859811704183484516925440.0f;
index 3d569222cd25d29238562501d6ae78a9633d7058..631f382278becf7486a0b5dd9d47d905d0e7f10d 100644 (file)
@@ -324,7 +324,7 @@ float CheatCommand(entity this, int argc)
                                //   effectname
                                effectnum = _particleeffectnum(argv(1));
                                W_SetupShot(this, weaponentities[0], false, false, SND_Null, CH_WEAPON_A, 0);
-                               traceline(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, MOVE_NORMAL, this);
+                               traceline(w_shotorg, w_shotorg + w_shotdir * max_shot_distance, MOVE_NORMAL, this);
                                __trailparticles(this, effectnum, w_shotorg, trace_endpos);
                                DID_CHEAT();
                                break;
index 55879fd35b1f51eb55a28838fd522aeee6376b59..8c9d915a213a80e31c35fd2c1fcbfb065921c7c1 100644 (file)
@@ -34,7 +34,6 @@ void PutObserverInServer(entity this);
 
 // =====================================================
 //  Server side game commands code, reworked by Samual
-//  Last updated: December 29th, 2011
 // =====================================================
 
 //  used by GameCommand_make_mapinfo()
@@ -1348,90 +1347,37 @@ void GameCommand_shuffleteams(float request)
        {
                case CMD_REQUEST_COMMAND:
                {
-                       if (teamplay)
+                       if (!teamplay)
                        {
-                               float t_teams, t_players, team_color;
-
-                               // count the total amount of players and total amount of teams
-                               t_players = 0;
-                               t_teams = 0;
-                               FOREACH_CLIENT(IS_PLAYER(it) || it.caplayer, LAMBDA(
-                                       CheckAllowedTeams(it);
-
-                                       if (c1 >= 0) t_teams = max(1, t_teams);
-                                       if (c2 >= 0) t_teams = max(2, t_teams);
-                                       if (c3 >= 0) t_teams = max(3, t_teams);
-                                       if (c4 >= 0) t_teams = max(4, t_teams);
-
-                                       ++t_players;
-                               ));
-
-                               // build a list of the players in a random order
-                               FOREACH_CLIENT(IS_PLAYER(it) || it.caplayer, LAMBDA(
-                                       for ( ; ; )
-                                       {
-                                               int idx = bound(1, floor(random() * maxclients) + 1, maxclients);
-
-                                               if (shuffleteams_players[idx])
-                                               {
-                                                       continue;  // a player is already assigned to this slot
-                                               }
-                                               else
-                                               {
-                                                       shuffleteams_players[idx] = etof(it);
-                                                       break;
-                                               }
-                                       }
-                               ));
-
-                               // finally, from the list made earlier, re-join the players in different order.
-                               for (int i = 1; i <= t_teams; ++i)
-                               {
-                                       // find out how many players to assign to this team
-                                       int pnum = (t_players / t_teams);
-                                       pnum = ((i == 1) ? ceil(pnum) : floor(pnum));
-
-                                       team_color = Team_NumberToTeam(i);
-
-                                       // sort through the random list of players made earlier
-                                       for (int z = 1; z <= maxclients; ++z)
-                                       {
-                                               if (!(shuffleteams_teams[i] >= pnum))
-                                               {
-                                                       if (!(shuffleteams_players[z])) continue;  // not a player, move on to next random slot
-
-                                                       entity e = NULL;
-                                                       if(VerifyClientNumber(shuffleteams_players[z]))
-                                                               e = edict_num(shuffleteams_players[z]);
-
-                                                       if(!e) continue; // unverified
-
-                                                       if (e.team != team_color) MoveToTeam(e, team_color, 6);
+                               LOG_INFO("Can't shuffle teams when currently not playing a team game.\n");
+                               return;
+                       }
 
-                                                       shuffleteams_players[z] = 0;
-                                                       shuffleteams_teams[i] = shuffleteams_teams[i] + 1;
-                                               }
-                                               else
-                                               {
-                                                       break;  // move on to next team
-                                               }
-                                       }
+                       FOREACH_CLIENT(IS_PLAYER(it) || it.caplayer, LAMBDA(
+                               if (it.team_forced) {
+                                       // we could theoretically assign forced players to their teams
+                                       // and shuffle the rest to fill the empty spots but in practise
+                                       // either all players or none are gonna have forced teams
+                                       LOG_INFO("Can't shuffle teams because at least one player has a forced team.\n");
+                                       return;
                                }
+                       ));
 
-                               bprint("Successfully shuffled the players around randomly.\n");
-
-                               // clear the buffers now
-                               for (int i = 0; i < SHUFFLETEAMS_MAX_PLAYERS; ++i)
-                                       shuffleteams_players[i] = 0;
-
-                               for (int i = 0; i < SHUFFLETEAMS_MAX_TEAMS; ++i)
-                                       shuffleteams_teams[i] = 0;
-                       }
-                       else
-                       {
-                               LOG_INFO("Can't shuffle teams when currently not playing a team game.\n");
-                       }
+                       int number_of_teams = 0;
+                       CheckAllowedTeams(NULL);
+                       if (c1 >= 0) number_of_teams = max(1, number_of_teams);
+                       if (c2 >= 0) number_of_teams = max(2, number_of_teams);
+                       if (c3 >= 0) number_of_teams = max(3, number_of_teams);
+                       if (c4 >= 0) number_of_teams = max(4, number_of_teams);
+
+                       int team_index = 0;
+                       FOREACH_CLIENT_RANDOM(IS_PLAYER(it) || it.caplayer, LAMBDA(
+                               int target_team_number = Team_NumberToTeam(team_index + 1);
+                               if (it.team != target_team_number) MoveToTeam(it, target_team_number, 6);
+                               team_index = (team_index + 1) % number_of_teams;
+                       ));
 
+                       bprint("Successfully shuffled the players around randomly.\n");
                        return;
                }
 
index 29db3ee4df20d5edd5c4f4614ca5fccc1f5b16b9..00e216c921855757b9a5aa87c23cfe5362fdbf9b 100644 (file)
@@ -2,17 +2,11 @@
 
 // =================================================
 //  Declarations for server side game commands
-//  Last updated: December 25th, 2011
 // =================================================
 
 string GotoMap(string m);
 
 void race_deleteTime(string map, float pos);
 
-const float SHUFFLETEAMS_MAX_PLAYERS = 255;
-const float SHUFFLETEAMS_MAX_TEAMS = 4;
-float shuffleteams_players[SHUFFLETEAMS_MAX_PLAYERS]; // maximum of 255 player slots
-float shuffleteams_teams[SHUFFLETEAMS_MAX_TEAMS];     // maximum of 4 teams
-
 // used by common/command/generic.qc:GenericCommand_dumpcommands to list all commands into a .txt file
 void GameCommand_macro_write_aliases(float fh);
index ac19363cca71453481684233336c8bd6a3a35819..d5ad30104d440d7c16395915591bdbe28a94e271 100644 (file)
@@ -738,7 +738,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d
                }
 
                // should this be changed at all? If so, in what way?
-               MUTATOR_CALLHOOK(PlayerDamage_Calculate, inflictor, attacker, targ, deathtype, damage, mirrordamage, force);
+               MUTATOR_CALLHOOK(Damage_Calculate, inflictor, attacker, targ, deathtype, damage, mirrordamage, force);
                damage = M_ARGV(4, float);
                mirrordamage = M_ARGV(5, float);
                force = M_ARGV(6, vector);
index a546a6714d3b9afd441bad4a46d0c59b28316beb..64c767e5f38d5ba65459c210fc7d76bec08075e9 100644 (file)
@@ -33,7 +33,7 @@
 
 void crosshair_trace(entity pl)
 {
-       traceline_antilag(pl, pl.cursor_trace_start, pl.cursor_trace_start + normalize(pl.cursor_trace_endpos - pl.cursor_trace_start) * MAX_SHOT_DISTANCE, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl));
+       traceline_antilag(pl, pl.cursor_trace_start, pl.cursor_trace_start + normalize(pl.cursor_trace_endpos - pl.cursor_trace_start) * max_shot_distance, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl));
 }
 .bool ctrace_solidchanged;
 void crosshair_trace_plusvisibletriggers(entity pl)
@@ -57,7 +57,7 @@ void crosshair_trace_plusvisibletriggers(entity pl)
 }
 void WarpZone_crosshair_trace(entity pl)
 {
-       WarpZone_traceline_antilag(pl, pl.cursor_trace_start, pl.cursor_trace_start + normalize(pl.cursor_trace_endpos - pl.cursor_trace_start) * MAX_SHOT_DISTANCE, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl));
+       WarpZone_traceline_antilag(pl, pl.cursor_trace_start, pl.cursor_trace_start + normalize(pl.cursor_trace_endpos - pl.cursor_trace_start) * max_shot_distance, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl));
 }
 
 
index fb0f977a7254ca145a11dbec70b67f0c815f9301..125a285be910707de26af1b15c4d2506d1de2758 100644 (file)
@@ -353,7 +353,7 @@ MUTATOR_HOOKABLE(PlayerDamage_SplitHealthArmor, EV_PlayerDamage_SplitHealthArmor
  * called to adjust damage and force values which are applied to the player, used for e.g. strength damage/force multiplier
  * i'm not sure if I should change this around slightly (Naming of the entities, and also how they're done in g_damage).
  */
-#define EV_PlayerDamage_Calculate(i, o) \
+#define EV_Damage_Calculate(i, o) \
     /** inflictor              */ i(entity, MUTATOR_ARGV_0_entity) \
     /** attacker       */ i(entity, MUTATOR_ARGV_1_entity) \
     /** target                 */ i(entity, MUTATOR_ARGV_2_entity) \
@@ -365,7 +365,7 @@ MUTATOR_HOOKABLE(PlayerDamage_SplitHealthArmor, EV_PlayerDamage_SplitHealthArmor
     /** force           */ i(vector, MUTATOR_ARGV_6_vector) \
     /** force                  */ o(vector, MUTATOR_ARGV_6_vector) \
     /**/
-MUTATOR_HOOKABLE(PlayerDamage_Calculate, EV_PlayerDamage_Calculate);
+MUTATOR_HOOKABLE(Damage_Calculate, EV_Damage_Calculate);
 
 /**
  * Called when a player is damaged
index 39987414348d0d3a37556741a320eb755e3a1cb3..28e91f26a3668181c9a0b83b68c483d0fa5673fa 100644 (file)
@@ -1,5 +1,7 @@
 #include "gamemode_assault.qh"
 
+#include <lib/float.qh>
+
 .entity sprite;
 #define AS_ROUND_DELAY 5
 
@@ -549,7 +551,7 @@ MUTATOR_HOOKFUNCTION(as, TurretSpawn)
 {
        entity turret = M_ARGV(0, entity);
 
-       if(!turret.team || turret.team == MAX_SHOT_DISTANCE)
+       if(!turret.team || turret.team == FLOAT_MAX)
                turret.team = 5; // this gets reversed when match starts?
 }
 
index 561a30d222a40b223d14d41a702403efba0f2a14..44c9d1592a4da0e78230d3d0c0993045341294fe 100644 (file)
@@ -321,7 +321,7 @@ MUTATOR_HOOKFUNCTION(ca, SetStartItems)
        start_ammo_fuel    = warmup_start_ammo_fuel    = cvar("g_lms_start_ammo_fuel");
 }
 
-MUTATOR_HOOKFUNCTION(ca, PlayerDamage_Calculate)
+MUTATOR_HOOKFUNCTION(ca, Damage_Calculate)
 {
        entity frag_attacker = M_ARGV(1, entity);
        entity frag_target = M_ARGV(2, entity);
index d1c97bd2856f90d2e227f1deb65f1e314a676227..6036fa529e6ffcf8906a5bd9104bd5f63b300dcc 100644 (file)
@@ -2083,7 +2083,7 @@ MUTATOR_HOOKFUNCTION(ctf, PlayerPreThink)
                WaypointSprite_UpdateHealth(player.wps_flagcarrier, '1 0 0' * healtharmor_maxdamage(player.health, player.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id));
 }
 
-MUTATOR_HOOKFUNCTION(ctf, PlayerDamage_Calculate) // for changing damage and force values that are applied to players in g_damage.qc
+MUTATOR_HOOKFUNCTION(ctf, Damage_Calculate) // for changing damage and force values that are applied to players in g_damage.qc
 {
        entity frag_attacker = M_ARGV(1, entity);
        entity frag_target = M_ARGV(2, entity);
index f83eb6b649a577568d1e796f6e1bafdca54088d9..21098a5e996f04ddf213b20bd2042d844226fd52 100644 (file)
@@ -312,7 +312,7 @@ MUTATOR_HOOKFUNCTION(cts, FilterItem)
                return true;
 }
 
-MUTATOR_HOOKFUNCTION(cts, PlayerDamage_Calculate)
+MUTATOR_HOOKFUNCTION(cts, Damage_Calculate)
 {
        entity frag_attacker = M_ARGV(1, entity);
        entity frag_target = M_ARGV(2, entity);
index 1496feec595cdd2ec0fb83b0026ba267ae7380a7..58e49980cc2439a0bcb5fa4a5fa72260886fa0bd 100644 (file)
@@ -342,7 +342,7 @@ MUTATOR_HOOKFUNCTION(inv, PlayerSpawn)
        player.bot_attack = false;
 }
 
-MUTATOR_HOOKFUNCTION(inv, PlayerDamage_Calculate)
+MUTATOR_HOOKFUNCTION(inv, Damage_Calculate)
 {
        entity frag_attacker = M_ARGV(1, entity);
        entity frag_target = M_ARGV(2, entity);
index 6fa76d6c5c1e140fb15382fffbd15118979f8b23..b948c6d5e229e91601e89c49b6d62bc0cc6c2cfc 100644 (file)
@@ -323,7 +323,7 @@ MUTATOR_HOOKFUNCTION(ka, PlayerUseKey)
        }
 }
 
-MUTATOR_HOOKFUNCTION(ka, PlayerDamage_Calculate) // for changing damage and force values that are applied to players in g_damage.qc
+MUTATOR_HOOKFUNCTION(ka, Damage_Calculate) // for changing damage and force values that are applied to players in g_damage.qc
 {
        entity frag_attacker = M_ARGV(1, entity);
        entity frag_target = M_ARGV(2, entity);
index 50708f33eb9b1aa53b0c7ceb7640198990a5df11..7074c0633f40e8d2e1f9c6efa15f96243e13d62f 100644 (file)
@@ -319,9 +319,9 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
 
        if(!DEATH_ISSPECIAL(deathtype))
        {
-               damage *= sqrt(bound(1.0, this.cvar_cl_handicap, 100.0));
+               damage *= bound(1.0, this.cvar_cl_handicap, 10.0);
                if(this != attacker)
-                       damage /= sqrt(bound(1.0, attacker.cvar_cl_handicap, 100.0));
+                       damage /= bound(1.0, attacker.cvar_cl_handicap, 10.0);
        }
 
        if (time < this.spawnshieldtime && autocvar_g_spawnshield_blockdamage < 1)
index 0918130159a737e83e63f5bd076af7320e3dc533..fd9f340f5f1965bdbdd370cde24121517abcdfb1 100644 (file)
@@ -52,6 +52,11 @@ void InitGameplayMode()
        get_mi_min_max(1);
        world.mins = mi_min;
        world.maxs = mi_max;
+       // currently, NetRadiant's limit is 131072 qu for each side
+       // distance from one corner of a 131072qu cube to the opposite corner is approx. 227023 qu
+       // set the distance according to map size but don't go over the limit to avoid issues with float precision
+       // in case somebody makes extremely large maps
+       max_shot_distance = min(230000, vlen(world.maxs - world.mins));
 
        MapInfo_LoadMapSettings(mapname);
        serverflags &= ~SERVERFLAG_TEAMPLAY;
index d148ab54f4597de3da7193d05c8104bd09a7fc80..2a4ca8dc3799503498d84f46e5ff13d91adf379c 100644 (file)
@@ -67,7 +67,7 @@ void W_HitPlotAnalysis(entity player, .entity weaponentity, vector screenforward
                        lag = 0; // only antilag for clients
 
                org = player.origin + player.view_ofs;
-               traceline_antilag_force(player, org, org + screenforward * MAX_SHOT_DISTANCE, MOVE_NORMAL, player, lag);
+               traceline_antilag_force(player, org, org + screenforward * max_shot_distance, MOVE_NORMAL, player, lag);
                if(IS_CLIENT(trace_ent) || IS_MONSTER(trace_ent))
                {
                    entity store = IS_CLIENT(trace_ent) ? CS(trace_ent) : trace_ent;
index 1417717e834e33270ed355d891a450bb73767938..66a76fcf9784329f2b1b3934c04913b57acb3ca6 100644 (file)
@@ -354,7 +354,7 @@ void fireBullet(entity this, .entity weaponentity, vector start, vector dir, flo
        vector  end;
 
        dir = normalize(dir + randomvec() * spread);
-       end = start + dir * MAX_SHOT_DISTANCE;
+       end = start + dir * max_shot_distance;
 
        fireBullet_last_hit = NULL;
        float solid_penetration_left = 1;
@@ -399,6 +399,10 @@ void fireBullet(entity this, .entity weaponentity, vector start, vector dir, flo
                start = trace_endpos;
                entity hit = trace_ent;
 
+               // traced up to max_shot_distance and didn't hit anything at all
+               if (trace_fraction == 1.0)
+                       break;
+
                // When hitting sky, stop.
                if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)
                        break;
index aec274143bd12c69db06411f00648b3d8c3a5187..0c17e197497988a2ccdee5e4bcbdbe6901f9053b 100644 (file)
@@ -9,7 +9,7 @@ vector w_shotend;
 // make sure you call makevectors first (FIXME?)
 void W_SetupShot_Dir_ProjectileSize_Range(entity ent, .entity weaponentity, vector s_forward, vector mi, vector ma, float antilag, float recoil, Sound snd, float chan, float maxdamage, float range);
 
-#define W_SetupShot_Dir_ProjectileSize(ent,wepent,s_forward,mi,ma,antilag,recoil,snd,chan,maxdamage) W_SetupShot_Dir_ProjectileSize_Range(ent, wepent, s_forward, mi, ma, antilag, recoil, snd, chan, maxdamage, MAX_SHOT_DISTANCE)
+#define W_SetupShot_Dir_ProjectileSize(ent,wepent,s_forward,mi,ma,antilag,recoil,snd,chan,maxdamage) W_SetupShot_Dir_ProjectileSize_Range(ent, wepent, s_forward, mi, ma, antilag, recoil, snd, chan, maxdamage, max_shot_distance)
 #define W_SetupShot_ProjectileSize(ent,wepent,mi,ma,antilag,recoil,snd,chan,maxdamage) W_SetupShot_Dir_ProjectileSize(ent, wepent, v_forward, mi, ma, antilag, recoil, snd, chan, maxdamage)
 #define W_SetupShot_Dir(ent,wepent,s_forward,antilag,recoil,snd,chan,maxdamage) W_SetupShot_Dir_ProjectileSize(ent, wepent, s_forward, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage)
 #define W_SetupShot(ent,wepent,antilag,recoil,snd,chan,maxdamage) W_SetupShot_ProjectileSize(ent, wepent, '0 0 0', '0 0 0', antilag, recoil, snd, chan, maxdamage)