Merge commit '40b7b8b8f77676', fixes #1937
authorRudolf Polzer <divverent@xonotic.org>
Wed, 4 Jun 2014 09:27:34 +0000 (11:27 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Wed, 4 Jun 2014 09:27:34 +0000 (11:27 +0200)
* commit '40b7b8b8f77676':
  Some improvements to invasion (allow team based invasion if map specifies, allow more monsters to spawn at the same time, precache monsters only if they're used)
  Some minor improvements to monsters (auto precache default model, use monster kills as main point limit in invasion)
  Add a monsters mapinfo feature
  Fix invasion monster spawn counts, fix spawning random monsters, clean up monster spawn system to no longer abuse target_spawn_edit_entity, allow monsters to chase targets through warpzones, fix shambler stomping while in the air, add a new "invincible" spawnflag which prevents monster from taking damage, allow dragging monsters around in edit mode and fix monster count off when monster is gibbed

41 files changed:
defaultXonotic.cfg
models/ok_player/okmale1.dpm_0.txt
models/ok_player/okmale2.dpm_0.txt
models/ok_player/okmale3.dpm_0.txt
models/ok_player/okmale4.dpm_0.txt
models/ok_player/okrobot1.dpm_0.txt
models/ok_player/okrobot2.dpm_0.txt
models/ok_player/okrobot3.dpm_0.txt
models/ok_player/okrobot4.dpm_0.txt
particles/hook_green.tga [deleted file]
particles/hook_white.tga [new file with mode: 0644]
qcsrc/client/Main.qc
qcsrc/client/View.qc
qcsrc/client/autocvars.qh
qcsrc/client/hook.qc
qcsrc/client/miscfunctions.qc
qcsrc/client/scoreboard.qc
qcsrc/client/waypointsprites.qc
qcsrc/common/notifications.qh
qcsrc/menu/xonotic/keybinder.c
qcsrc/menu/xonotic/util.qc
qcsrc/server/anticheat.qc
qcsrc/server/anticheat.qh
qcsrc/server/bot/havocbot/havocbot.qc
qcsrc/server/cl_client.qc
qcsrc/server/cl_physics.qc
qcsrc/server/cl_player.qc
qcsrc/server/command/cmd.qc
qcsrc/server/command/getreplies.qc
qcsrc/server/command/sv_cmd.qc
qcsrc/server/g_damage.qc
qcsrc/server/g_world.qc
qcsrc/server/mutators/gamemode_ctf.qc
qcsrc/server/mutators/gamemode_keepaway.qc
qcsrc/server/mutators/gamemode_nexball.qc
qcsrc/server/mutators/mutator_spawn_near_teammate.qc
qcsrc/server/playerstats.qc
qcsrc/server/sv_main.qc
qcsrc/server/t_teleporters.qc
qcsrc/server/target_music.qc
qcsrc/server/w_minelayer.qc

index 747e0c4..2c048b3 100644 (file)
@@ -56,7 +56,7 @@ _cl_playermodel models/player/erebus.iqm
 _cl_playerskin 0
 
 seta cl_reticle 1 "control for toggling whether ANY zoom reticles are shown"
-seta cl_reticle_stretch 0 "whether to stretch reticles so they fit the screen (brakes image proportions)"
+seta cl_reticle_stretch 0 "whether to stretch reticles so they fit the screen (breaks image proportions)"
 seta cl_reticle_item_nex 1 "draw aiming reticle for the nex weapon's zoom, 0 disables and values between 0 and 1 change alpha"
 seta cl_reticle_item_normal 1 "draw reticle when zooming with the zoom button, 0 disables and values between 0 and 1 change alpha"
 fov 100
@@ -224,6 +224,7 @@ seta cl_hitsound 1 "play a hit notifier sound when you have hit an enemy"
 set cl_hitsound_antispam_time 0.05 "don't play the hitsound more often than this"
 
 seta cl_eventchase_death 1 "camera goes into 3rd person mode when the player is dead"
+seta cl_eventchase_nexball 1 "camera goes into 3rd person mode when in nexball game-mode"
 seta cl_eventchase_distance 140 "final camera distance"
 seta cl_eventchase_speed 1.3 "how fast the camera slides back, 0 is instant"
 seta cl_eventchase_maxs "12 12 8" "max size of eventchase camera bbox"
index da0d2a1..b9f8a15 100644 (file)
@@ -3,5 +3,12 @@ species human
 sex Male
 weight 105
 age 26
+bone_upperbody Bip001 Neck
+bone_aim0 0.25 Bip001 Neck
+bone_aim1 0.4 Bip001 Neck
+bone_aim2 0.2 Bip001 L UpperArm
+bone_aim3 0.35 bip01 r hand
+bone_weapon bip01 r hand
+fixbone 1
 
 overkill solider
index 3e3a6cf..96c2f5b 100644 (file)
@@ -3,5 +3,12 @@ species human
 sex Male
 weight 105
 age 26
+bone_upperbody Bip001 Neck
+bone_aim0 0.25 Bip001 Neck
+bone_aim1 0.4 Bip001 Neck
+bone_aim2 0.2 Bip001 L UpperArm
+bone_aim3 0.35 bip01 r hand
+bone_weapon bip01 r hand
+fixbone 1
 
 overkill officer
\ No newline at end of file
index 7fa399e..406aac2 100644 (file)
@@ -3,5 +3,12 @@ species human
 sex Male
 weight 105
 age 28
+bone_upperbody Bip001 Neck
+bone_aim0 0.25 Bip001 Neck
+bone_aim1 0.4 Bip001 Neck
+bone_aim2 0.2 Bip001 L UpperArm
+bone_aim3 0.35 bip01 r hand
+bone_weapon bip01 r hand
+fixbone 1
 
 overkill solider
index 7fa399e..406aac2 100644 (file)
@@ -3,5 +3,12 @@ species human
 sex Male
 weight 105
 age 28
+bone_upperbody Bip001 Neck
+bone_aim0 0.25 Bip001 Neck
+bone_aim1 0.4 Bip001 Neck
+bone_aim2 0.2 Bip001 L UpperArm
+bone_aim3 0.35 bip01 r hand
+bone_weapon bip01 r hand
+fixbone 1
 
 overkill solider
index 0b52a01..844f425 100644 (file)
@@ -3,5 +3,12 @@ species robot_solid
 sex None
 weight 200
 age 1
+bone_upperbody Bip001 Neck
+bone_aim0 0.25 Bip001 Neck
+bone_aim1 0.4 Bip001 Neck
+bone_aim2 0.2 Bip001 L UpperArm
+bone_aim3 0.35 bip01 r hand
+bone_weapon bip01 r hand
+fixbone 1
 
 Overkill robot
index 0b52a01..844f425 100644 (file)
@@ -3,5 +3,12 @@ species robot_solid
 sex None
 weight 200
 age 1
+bone_upperbody Bip001 Neck
+bone_aim0 0.25 Bip001 Neck
+bone_aim1 0.4 Bip001 Neck
+bone_aim2 0.2 Bip001 L UpperArm
+bone_aim3 0.35 bip01 r hand
+bone_weapon bip01 r hand
+fixbone 1
 
 Overkill robot
index 3157342..03dd3f2 100644 (file)
@@ -3,5 +3,12 @@ species robot_solid
 sex None
 weight 200
 age 1
+bone_upperbody Bip001 Neck
+bone_aim0 0.25 Bip001 Neck
+bone_aim1 0.4 Bip001 Neck
+bone_aim2 0.2 Bip001 L UpperArm
+bone_aim3 0.35 bip01 r hand
+bone_weapon bip01 r hand
+fixbone 1
 
 Overkill robot
index 3157342..03dd3f2 100644 (file)
@@ -3,5 +3,12 @@ species robot_solid
 sex None
 weight 200
 age 1
+bone_upperbody Bip001 Neck
+bone_aim0 0.25 Bip001 Neck
+bone_aim1 0.4 Bip001 Neck
+bone_aim2 0.2 Bip001 L UpperArm
+bone_aim3 0.35 bip01 r hand
+bone_weapon bip01 r hand
+fixbone 1
 
 Overkill robot
diff --git a/particles/hook_green.tga b/particles/hook_green.tga
deleted file mode 100644 (file)
index e01eb47..0000000
Binary files a/particles/hook_green.tga and /dev/null differ
diff --git a/particles/hook_white.tga b/particles/hook_white.tga
new file mode 100644 (file)
index 0000000..c60f070
Binary files /dev/null and b/particles/hook_white.tga differ
index db99e50..4ea750c 100644 (file)
@@ -214,7 +214,7 @@ float SetTeam(entity o, float Team)
                        default:
                                if(GetTeam(Team, false) == world)
                                {
-                                       printf(_("trying to switch to unsupported team %d\n"), Team);
+                                       dprintf("trying to switch to unsupported team %d\n", Team);
                                        Team = NUM_SPECTATOR;
                                }
                                break;
@@ -230,7 +230,7 @@ float SetTeam(entity o, float Team)
                        default:
                                if(GetTeam(Team, false) == world)
                                {
-                                       printf(_("trying to switch to unsupported team %d\n"), Team);
+                                       dprintf("trying to switch to unsupported team %d\n", Team);
                                        Team = NUM_SPECTATOR;
                                }
                                break;
index 85dfe54..2a41ba1 100644 (file)
@@ -492,7 +492,8 @@ void CSQC_UpdateView(float w, float h)
        // event chase camera
        if(autocvar_chase_active <= 0) // greater than 0 means it's enabled manually, and this code is skipped
        {
-               if(((spectatee_status >= 0 && (autocvar_cl_eventchase_death && is_dead)) || intermission) && !autocvar_cl_orthoview)
+               WepSet weapons_stat = WepSet_GetFromStat();
+               if(((spectatee_status >= 0 && (autocvar_cl_eventchase_death && is_dead)) || intermission) && !autocvar_cl_orthoview || (autocvar_cl_eventchase_nexball && gametype == MAPINFO_TYPE_NEXBALL && !(weapons_stat & WepSet_FromWeapon(WEP_PORTO))))
                {
                        // make special vector since we can't use view_origin (It is one frame old as of this code, it gets set later with the results this code makes.)
                        vector current_view_origin = (csqcplayer ? csqcplayer.origin : pmove_org);
index 5ba321a..67a0325 100644 (file)
@@ -410,6 +410,7 @@ float autocvar_viewsize;
 float autocvar_cl_hitsound;
 float autocvar_cl_hitsound_antispam_time;
 var float autocvar_cl_eventchase_death = 1;
+var float autocvar_cl_eventchase_nexball = 1;
 var float autocvar_cl_eventchase_distance = 140;
 var float autocvar_cl_eventchase_speed = 1.3;
 var vector autocvar_cl_eventchase_maxs = '12 12 8';
index 196730a..889e75d 100644 (file)
@@ -83,7 +83,7 @@ void Draw_GrapplingHook()
                        break;
        }
 
-       if((self.owner.sv_entnum == player_localentnum - 1))
+       if((self.owner.sv_entnum == player_localentnum - 1) && autocvar_chase_active <= 0)
        {
                switch(self.HookType)
                {
@@ -129,30 +129,13 @@ void Draw_GrapplingHook()
                case ENT_CLIENT_HOOK:
                        intensity = 1;
                        offset = 0;
-                       if(t == NUM_TEAM_1)
+                       switch(t)
                        {
-                               tex = "particles/hook_red";
-                               rgb = '1 .3 .3';
-                       }
-                       else if(t == NUM_TEAM_2)
-                       {
-                               tex = "particles/hook_blue";
-                               rgb = '.3 .3 1';
-                       }
-                       else if(t == NUM_TEAM_3)
-                       {
-                               tex = "particles/hook_yellow";
-                               rgb = '1 1 .3';
-                       }
-                       else if(t == NUM_TEAM_4)
-                       {
-                               tex = "particles/hook_pink";
-                               rgb = '1 .3 1';
-                       }
-                       else
-                       {
-                               tex = "particles/hook_green";
-                               rgb = '.3 1 .3';
+                               case NUM_TEAM_1: tex = "particles/hook_red"; rgb = '1 0.3 0.3'; break;
+                               case NUM_TEAM_2: tex = "particles/hook_blue"; rgb = '0.3 0.3 1'; break;
+                               case NUM_TEAM_3: tex = "particles/hook_yellow"; rgb = '1 1 0.3'; break;
+                               case NUM_TEAM_4: tex = "particles/hook_pink"; rgb = '1 0.3 1'; break;
+                               default: tex = "particles/hook_white"; rgb = getcsqcplayercolor(self.sv_entnum); break;
                        }
                        break;
                case ENT_CLIENT_LGBEAM:
@@ -232,7 +215,9 @@ void Ent_ReadHook(float bIsNew, float type)
 
        if(sf & 1)
        {
-               self.owner = playerslots[ReadByte() - 1];
+               float myowner = ReadByte();
+               self.owner = playerslots[myowner - 1];
+               self.sv_entnum = myowner;
                switch(self.HookType)
                {
                        default:
index fbdbc45..8b674e7 100644 (file)
@@ -589,6 +589,20 @@ float getplayeralpha(float pl)
        return 1;
 }
 
+vector getcsqcplayercolor(float pl)
+{
+       entity e;
+
+       e = CSQCModel_server2csqc(pl);
+       if(e)
+       {
+               if(e.colormap > 0)
+                       return colormapPaletteColor(((e.colormap >= 1024) ? e.colormap : stof(getplayerkeyvalue(e.colormap - 1, "colors"))) & 0x0F, TRUE);
+       }
+
+       return '1 1 1';
+}
+
 float getplayerisdead(float pl)
 {
        entity e;
index dd419ae..46dcfb4 100644 (file)
@@ -1313,7 +1313,7 @@ void HUD_DrawScoreboard()
                }
                pos = HUD_DrawScoreboardRankings(pos, playerslots[player_localnum], rgb, bg_size);
        }
-       else if(autocvar_scoreboard_accuracy && spectatee_status != -1 && !warmup_stage) {
+       else if(autocvar_scoreboard_accuracy && spectatee_status == 0 && !warmup_stage && gametype != MAPINFO_TYPE_NEXBALL) {
                if(teamplay)
                        pos = HUD_DrawScoreboardAccuracyStats(pos, Team_ColorRGB(myteam), bg_size);
                else
@@ -1349,7 +1349,7 @@ void HUD_DrawScoreboard()
 
        // Print info string
        float tl, fl, ll;
-       str = sprintf(_("playing on ^2%s^7"), shortmapname);
+       str = sprintf(_("playing ^3%s^7 on ^2%s^7"), MapInfo_Type_ToText(gametype), shortmapname);
        tl = getstatf(STAT_TIMELIMIT);
        fl = getstatf(STAT_FRAGLIMIT);
        ll = getstatf(STAT_LEADLIMIT);
@@ -1407,6 +1407,7 @@ void HUD_DrawScoreboard()
 
        // print information about respawn status
        float respawn_time = getstatf(STAT_RESPAWN_TIME);
+       if(!intermission)
        if(respawn_time)
        {
                if(respawn_time < 0)
index dd7ae36..1367501 100644 (file)
@@ -277,6 +277,7 @@ string spritelookuptext(string s)
                case "race-finish": return _("Finish");
                case "race-start": return _("Start");
                case "race-start-finish": return (race_checkpointtime || race_mycheckpointtime) ? _("Finish") : _("Start");
+               case "goal": return _("Goal");
                case "nb-ball": return _("Ball");
                case "ka-ball": return _("Ball");
                case "ka-ballcarrier": return _("Ball carrier");
index 003c0fc..117965f 100644 (file)
@@ -637,6 +637,7 @@ void Send_Notification_WOCOVA(
        MSG_CENTER_NOTIF(1, CENTER_JOIN_PREVENT,                0, 0, "",              CPID_PREVENT_JOIN,     "0 0", _("^K1You may not join the game at this time.\nThe player limit reached maximum capacity."), "") \
        MSG_CENTER_NOTIF(1, CENTER_KEEPAWAY_DROPPED,            1, 0, "s1",            CPID_KEEPAWAY,         "0 0", _("^BG%s^BG has dropped the ball!"), "") \
        MSG_CENTER_NOTIF(1, CENTER_KEEPAWAY_PICKUP,             1, 0, "s1",            CPID_KEEPAWAY,         "0 0", _("^BG%s^BG has picked up the ball!"), "") \
+       MSG_CENTER_NOTIF(1, CENTER_KEEPAWAY_PICKUP_SELF,        0, 0, "",              CPID_KEEPAWAY,         "0 0", _("^BGYou picked up the ball"), "") \
        MSG_CENTER_NOTIF(1, CENTER_KEEPAWAY_WARN,               0, 0, "",              CPID_KEEPAWAY_WARN,    "0 0", _("^BGKilling people while you don't have the ball gives no points!"), "") \
        MSG_CENTER_NOTIF(1, CENTER_KEYHUNT_HELP,                0, 0, "",              CPID_KEYHUNT,          "0 0", _("^BGAll keys are in your team's hands!\nHelp the key carriers to meet!"), "") \
        MULTITEAM_CENTER(1, CENTER_KEYHUNT_INTERFERE_, 4,       0, 0, "",              CPID_KEYHUNT,          "0 0", _("^BGAll keys are in ^TC^TT team^BG's hands!\nInterfere ^F4NOW^BG!"), "") \
index d16e8bb..66c3486 100644 (file)
@@ -143,6 +143,13 @@ void XonoticKeyBinder_keyGrabbed(entity me, float key, float ascii)
        if(key == K_ESCAPE)
                return;
 
+       // forbid these keys from being bound in the menu
+       if(key == K_CAPSLOCK || key == K_NUMLOCK)
+       {
+               KeyBinder_Bind_Change(me, me);
+               return;
+       }
+
        func = Xonotic_KeyBinds_Functions[me.selectedItem];
        if(func == "")
                return;
index f06866c..74b60d3 100644 (file)
@@ -656,7 +656,7 @@ float updateCompression()
        GAMETYPE(MAPINFO_TYPE_LMS) \
        GAMETYPE(MAPINFO_TYPE_NEXBALL) \
        GAMETYPE(MAPINFO_TYPE_ONSLAUGHT) \
-       GAMETYPE(MAPINFO_TYPE_RACE) \
+       if (cvar("developer")) GAMETYPE(MAPINFO_TYPE_RACE) \
        GAMETYPE(MAPINFO_TYPE_CTS) \
        GAMETYPE(MAPINFO_TYPE_TEAM_DEATHMATCH) \
        //GAMETYPE(MAPINFO_TYPE_INVASION) \
@@ -667,7 +667,7 @@ float GameType_GetID(float cnt)
        float i;
        i = 0;
 
-       #define GAMETYPE(id) if(i++ == cnt) return id;
+       #define GAMETYPE(id) { if(i++ == cnt) return id; }
        GAMETYPES
        #undef GAMETYPE
 
index d00c60b..9a1872c 100644 (file)
@@ -25,6 +25,8 @@ float mean_evaluate(entity e, .float a, .float c, float mean)
 #define MEAN_EVALUATE(prefix) mean_evaluate(self,prefix##_accumulator,prefix##_count,prefix##_mean)
 #define MEAN_DECLARE(prefix,m) float prefix##_mean = m; .float prefix##_count, prefix##_accumulator
 
+.float anticheat_fixangle_endtime;
+
 float anticheat_div0_evade_evasion_delta;
 .float anticheat_div0_evade_offset;
 .vector anticheat_div0_evade_v_angle;
@@ -37,10 +39,32 @@ MEAN_DECLARE(anticheat_div0_strafebot_old, 5);
 .vector anticheat_div0_strafebot_forward_prev;
 MEAN_DECLARE(anticheat_div0_strafebot_new, 5);
 
+// Snap-aim detection: we track the average angular speed of aiming over time, in "radians per second".
+// Signal: a high-power mean. Cheaters will have high "signal" here.
+// Noise: a low-power mean. Active/shivery players will have high "noise" here.
+// Note one can always artificially add noise - so very high values of both signal and noise need to be checked too.
+MEAN_DECLARE(anticheat_idle_snapaim_signal, 5);
+MEAN_DECLARE(anticheat_idle_snapaim_noise, 1);
+
+// TEMP DEBUG STUFF.
+MEAN_DECLARE(anticheat_idle_snapaim_m2, 2);
+MEAN_DECLARE(anticheat_idle_snapaim_m3, 3);
+MEAN_DECLARE(anticheat_idle_snapaim_m4, 4);
+MEAN_DECLARE(anticheat_idle_snapaim_m7, 7);
+MEAN_DECLARE(anticheat_idle_snapaim_m10, 10);
+
 .float anticheat_speedhack_offset;
 .float anticheat_speedhack_movetime, anticheat_speedhack_movetime_count, anticheat_speedhack_movetime_frac;
 MEAN_DECLARE(anticheat_speedhack, 5);
 
+.float anticheat_speedhack_accu;
+.float anticheat_speedhack_lasttime;
+MEAN_DECLARE(anticheat_speedhack_m1, 1);
+MEAN_DECLARE(anticheat_speedhack_m2, 2);
+MEAN_DECLARE(anticheat_speedhack_m3, 3);
+MEAN_DECLARE(anticheat_speedhack_m4, 4);
+MEAN_DECLARE(anticheat_speedhack_m5, 5);
+
 float movement_oddity(vector m0, vector m1)
 {
        float cosangle = normalize(m0) * normalize(m1);
@@ -60,7 +84,7 @@ void anticheat_physics()
        if(self.anticheat_div0_evade_offset == 0)
        {
                f = fabs(anticheat_div0_evade_evasion_delta - floor(anticheat_div0_evade_evasion_delta) - 0.5) * 2; // triangle function
-               self.anticheat_div0_evade_offset = time + sys_frametime * (3 * f - 1);
+               self.anticheat_div0_evade_offset = servertime + sys_frametime * (3 * f - 1);
                self.anticheat_div0_evade_v_angle = self.v_angle;
                self.anticheat_div0_evade_forward_initial = v_forward;
                MEAN_ACCUMULATE(anticheat_div0_evade, 0, 1);
@@ -75,8 +99,32 @@ void anticheat_physics()
        MEAN_ACCUMULATE(anticheat_div0_strafebot_old, movement_oddity(self.movement, self.anticheat_div0_strafebot_movement_prev), 1);
        self.anticheat_div0_strafebot_movement_prev = self.movement;
 
-       if(vlen(self.anticheat_div0_strafebot_forward_prev))
-               MEAN_ACCUMULATE(anticheat_div0_strafebot_new, 0.5 - 0.5 * (self.anticheat_div0_strafebot_forward_prev * v_forward), 1);
+       // Note: this actually tries to detect snap-aim.
+       if(vlen(self.anticheat_div0_strafebot_forward_prev) && time > self.anticheat_fixangle_endtime) {
+               float cosangle = self.anticheat_div0_strafebot_forward_prev * v_forward;
+               float angle = cosangle < -1 ? M_PI : cosangle > 1 ? 0 : acos(cosangle);
+               /*
+               if (angle >= 10 * M_PI / 180)
+                       printf("SNAP %s: %f for %f, %f since fixangle\n", self.netname, angle * 180 / M_PI, cosangle, time - self.anticheat_fixangle_endtime);
+               */
+               MEAN_ACCUMULATE(anticheat_div0_strafebot_new, angle / M_PI, 1);
+
+               if (autocvar_slowmo > 0) {
+                       // Technically this is a NOP, as the engine should be ensuring
+                       // this in the first place. Let's guard against dividing by
+                       // zero anyway.
+                       float dt = max(0.001, frametime) / autocvar_slowmo;
+
+                       float anglespeed = angle / dt;
+                       MEAN_ACCUMULATE(anticheat_idle_snapaim_signal, anglespeed, dt);
+                       MEAN_ACCUMULATE(anticheat_idle_snapaim_noise, anglespeed, dt);
+                       MEAN_ACCUMULATE(anticheat_idle_snapaim_m2, anglespeed, dt);
+                       MEAN_ACCUMULATE(anticheat_idle_snapaim_m3, anglespeed, dt);
+                       MEAN_ACCUMULATE(anticheat_idle_snapaim_m4, anglespeed, dt);
+                       MEAN_ACCUMULATE(anticheat_idle_snapaim_m7, anglespeed, dt);
+                       MEAN_ACCUMULATE(anticheat_idle_snapaim_m10, anglespeed, dt);
+               }
+       }
        self.anticheat_div0_strafebot_forward_prev = v_forward;
 
        // generic speedhack detection: correlate anticheat_speedhack_movetime (UPDATED BEFORE THIS) and server time
@@ -94,6 +142,25 @@ void anticheat_physics()
                self.anticheat_speedhack_offset += (f - self.anticheat_speedhack_offset) * frametime * 0.1;
        }
 
+       // new generic speedhack detection
+       if (self.anticheat_speedhack_lasttime > 0) {
+               float dt = servertime - self.anticheat_speedhack_lasttime;
+               const float falloff = 0.2;
+               self.anticheat_speedhack_accu *= exp(-dt * falloff);
+               self.anticheat_speedhack_accu += frametime * falloff;
+               // NOTE: at cl_netfps x, this actually averages not to 1, but to 1/x * falloff / (1 - exp(-1/x * falloff))
+               // For 15 netfps (absolute minimum bearable), and 0.2 falloff, this is: 1.0067
+               self.anticheat_speedhack_lasttime = servertime;
+               MEAN_ACCUMULATE(anticheat_speedhack_m1, self.anticheat_speedhack_accu, frametime);
+               MEAN_ACCUMULATE(anticheat_speedhack_m2, self.anticheat_speedhack_accu, frametime);
+               MEAN_ACCUMULATE(anticheat_speedhack_m3, self.anticheat_speedhack_accu, frametime);
+               MEAN_ACCUMULATE(anticheat_speedhack_m4, self.anticheat_speedhack_accu, frametime);
+               MEAN_ACCUMULATE(anticheat_speedhack_m5, self.anticheat_speedhack_accu, frametime);
+       } else {
+               self.anticheat_speedhack_accu = 1;
+               self.anticheat_speedhack_lasttime = servertime;
+       }
+
        // race/CTS: force kbd movement for fairness
        if(g_race || g_cts)
        {
@@ -168,15 +235,69 @@ void anticheat_report()
 {
        if(!autocvar_sv_eventlog)
                return;
+       // TODO(divVerent): Use xonstat to acquire good thresholds.
        GameLogEcho(strcat(":anticheat:_time:", ftos(self.playerid), ":", ftos(servertime - self.anticheat_jointime)));
        GameLogEcho(strcat(":anticheat:speedhack:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_speedhack), 240, 0.1, 0.15)));
+       GameLogEcho(strcat(":anticheat:speedhack_m1:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_speedhack_m1), 240, 0.1, 0.15)));
+       GameLogEcho(strcat(":anticheat:speedhack_m2:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_speedhack_m2), 240, 0.1, 0.15)));
+       GameLogEcho(strcat(":anticheat:speedhack_m3:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_speedhack_m3), 240, 0.1, 0.15)));
+       GameLogEcho(strcat(":anticheat:speedhack_m4:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_speedhack_m4), 240, 0.1, 0.15)));
+       GameLogEcho(strcat(":anticheat:speedhack_m5:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_speedhack_m5), 240, 0.1, 0.15)));
        GameLogEcho(strcat(":anticheat:div0_strafebot_old:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_div0_strafebot_old), 120, 0.3, 0.4)));
        GameLogEcho(strcat(":anticheat:div0_strafebot_new:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_div0_strafebot_new), 120, 0.3, 0.4)));
        GameLogEcho(strcat(":anticheat:div0_evade:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_div0_evade), 120, 0.1, 0.2)));
+       GameLogEcho(strcat(":anticheat:idle_snapaim:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_idle_snapaim_signal) - MEAN_EVALUATE(anticheat_idle_snapaim_noise), 120, 0.1, 0.2)));
+       GameLogEcho(strcat(":anticheat:idle_snapaim_signal:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_idle_snapaim_signal), 120, 0.1, 0.2)));
+       GameLogEcho(strcat(":anticheat:idle_snapaim_noise:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_idle_snapaim_noise), 120, 0.1, 0.2)));
+       GameLogEcho(strcat(":anticheat:idle_snapaim_m2:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_idle_snapaim_m2), 120, 0.1, 0.2)));
+       GameLogEcho(strcat(":anticheat:idle_snapaim_m3:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_idle_snapaim_m3), 120, 0.1, 0.2)));
+       GameLogEcho(strcat(":anticheat:idle_snapaim_m4:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_idle_snapaim_m4), 120, 0.1, 0.2)));
+       GameLogEcho(strcat(":anticheat:idle_snapaim_m7:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_idle_snapaim_m7), 120, 0.1, 0.2)));
+       GameLogEcho(strcat(":anticheat:idle_snapaim_m10:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_idle_snapaim_m10), 120, 0.1, 0.2)));
+}
+
+float anticheat_getvalue(string id)
+{
+       switch(id) {
+               case "_time": return servertime - self.anticheat_jointime;
+               case "speedhack": return MEAN_EVALUATE(anticheat_speedhack);
+               case "speedhack_m1": return MEAN_EVALUATE(anticheat_speedhack_m1);
+               case "speedhack_m2": return MEAN_EVALUATE(anticheat_speedhack_m2);
+               case "speedhack_m3": return MEAN_EVALUATE(anticheat_speedhack_m3);
+               case "speedhack_m4": return MEAN_EVALUATE(anticheat_speedhack_m4);
+               case "speedhack_m5": return MEAN_EVALUATE(anticheat_speedhack_m5);
+               case "div0_strafebot_old": return MEAN_EVALUATE(anticheat_div0_strafebot_old);
+               case "div0_strafebot_new": return MEAN_EVALUATE(anticheat_div0_strafebot_new);
+               case "div0_evade": return MEAN_EVALUATE(anticheat_div0_evade);
+               case "idle_snapaim": return MEAN_EVALUATE(anticheat_idle_snapaim_signal) - MEAN_EVALUATE(anticheat_idle_snapaim_noise);
+               case "idle_snapaim_signal": return MEAN_EVALUATE(anticheat_idle_snapaim_signal);
+               case "idle_snapaim_noise": return MEAN_EVALUATE(anticheat_idle_snapaim_noise);
+               case "idle_snapaim_m2": return MEAN_EVALUATE(anticheat_idle_snapaim_m2);
+               case "idle_snapaim_m3": return MEAN_EVALUATE(anticheat_idle_snapaim_m3);
+               case "idle_snapaim_m4": return MEAN_EVALUATE(anticheat_idle_snapaim_m4);
+               case "idle_snapaim_m7": return MEAN_EVALUATE(anticheat_idle_snapaim_m7);
+               case "idle_snapaim_m10": return MEAN_EVALUATE(anticheat_idle_snapaim_m10);
+       }
+       return -1;
+}
+
+void anticheat_startframe()
+{
+       anticheat_div0_evade_evasion_delta += frametime * (0.5 + random());
+}
+
+void anticheat_fixangle()
+{
+       self.anticheat_fixangle_endtime = servertime + ANTILAG_LATENCY(self) + 0.2;
 }
 
-void anticheat_serverframe()
+void anticheat_endframe()
 {
+       entity oldself = self;
+       FOR_EACH_CLIENT(self)
+               if (self.fixangle)
+                       anticheat_fixangle();
+       self = oldself;
        anticheat_div0_evade_evasion_delta += frametime * (0.5 + random());
 }
 
index 80c7636..e46dcce 100644 (file)
@@ -6,4 +6,9 @@ void anticheat_physics();
 void anticheat_spectatecopy(entity spectatee);
 void anticheat_prethink();
 
-void anticheat_serverframe();
+float anticheat_getvalue(string name);
+
+void anticheat_startframe();
+void anticheat_endframe();
+
+void anticheat_fixangle();
index a0e6bff..2e57eec 100644 (file)
@@ -722,10 +722,10 @@ void havocbot_movetogoal()
                        vector dst_ahead, dst_down;
                        makevectors(self.v_angle_y * '0 1 0');
                        dst_ahead = self.origin + self.view_ofs + (self.velocity * 0.4) + (v_forward * 32 * 3);
-                       dst_down = dst_ahead + '0 0 -1500';
+                       dst_down = dst_ahead - '0 0 1500';
 
                        // Look ahead
-                       traceline(self.origin + self.view_ofs , dst_ahead, TRUE, world);
+                       traceline(self.origin + self.view_ofs, dst_ahead, TRUE, world);
 
                        // Check head-banging against walls
                        if(vlen(self.origin + self.view_ofs - trace_endpos) < 25 && !(self.aistatus & AI_STATUS_OUT_WATER))
index 691c493..d06bc96 100644 (file)
@@ -1425,7 +1425,7 @@ void player_powerups (void)
        // add a way to see what the items were BEFORE all of these checks for the mutator hook
        olditems = self.items;
 
-       if((self.items & IT_USING_JETPACK) && !self.deadflag)
+       if((self.items & IT_USING_JETPACK) && !self.deadflag && !gameover)
                self.modelflags |= MF_ROCKET;
        else
                self.modelflags &= ~MF_ROCKET;
index 0098561..43c7be5 100644 (file)
@@ -19,6 +19,9 @@ When you press the jump key
 */
 void PlayerJump (void)
 {
+       if(self.player_blocked)
+               return; // no jumping while blocked
+
        float doublejump = FALSE;
 
        player_multijump = doublejump;
@@ -636,9 +639,7 @@ void SV_PlayerPhysics()
 
        maxspd_mod = 1;
        if(self.ballcarried)
-               if(g_nexball)
-                       maxspd_mod *= autocvar_g_nexball_basketball_carrier_highspeed;
-               else if(g_keepaway)
+               if(g_keepaway)
                        maxspd_mod *= autocvar_g_keepaway_ballcarrier_highspeed;
 
        maxspd_mod *= autocvar_g_movement_highspeed;
index 67738c4..0fe71f1 100644 (file)
@@ -673,15 +673,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
 
                Portal_ClearAllLater(self);
 
-               if(IS_REAL_CLIENT(self))
-               {
-                       self.fixangle = TRUE;
-                       //msg_entity = self;
-                       //WriteByte (MSG_ONE, SVC_SETANGLE);
-                       //WriteAngle (MSG_ONE, self.v_angle_x);
-                       //WriteAngle (MSG_ONE, self.v_angle_y);
-                       //WriteAngle (MSG_ONE, 80);
-               }
+               self.fixangle = TRUE;
 
                if(defer_ClientKill_Now_TeamChange)
                        ClientKill_Now_TeamChange(); // can turn player into spectator
@@ -758,7 +750,7 @@ 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;
+       string msgstr, colorstr, cmsgstr, namestr, fullmsgstr, sourcemsgstr, fullcmsgstr, sourcecmsgstr, colorprefix;
        float flood;
        var .float flood_field;
        entity head;
@@ -803,14 +795,19 @@ float Say(entity source, float teamsay, entity privatesay, string msgin, float f
        else
                namestr = source.netname;
 
+       if(strdecolorize(namestr) == namestr)
+               colorprefix = "^3";
+       else
+               colorprefix = "^7";
+
        if(msgin != "")
        {
                if(privatesay)
                {
-                       msgstr = strcat("\{1}\{13}* ^3", namestr, "^3 tells you: ^7");
+                       msgstr = strcat("\{1}\{13}* ", colorprefix, namestr, "^3 tells you: ^7");
                        privatemsgprefixlen = strlen(msgstr);
                        msgstr = strcat(msgstr, msgin);
-                       cmsgstr = strcat(colorstr, "^3", namestr, "^3 tells you:\n^7", msgin);
+                       cmsgstr = strcat(colorstr, colorprefix, namestr, "^3 tells you:\n^7", msgin);
                        if(autocvar_g_chat_teamcolors)
                                privatemsgprefix = strcat("\{1}\{13}* ^3You tell ", playername(privatesay), ": ^7");
                        else
@@ -818,12 +815,12 @@ float Say(entity source, float teamsay, entity privatesay, string msgin, float f
                }
                else if(teamsay)
                {
-                       msgstr = strcat("\{1}\{13}", colorstr, "(^3", namestr, colorstr, ") ^7", msgin);
-                       cmsgstr = strcat(colorstr, "(^3", namestr, colorstr, ")\n^7", msgin);
+                       msgstr = strcat("\{1}\{13}", colorstr, "(", colorprefix, namestr, colorstr, ") ^7", msgin);
+                       cmsgstr = strcat(colorstr, "(", colorprefix, namestr, colorstr, ")\n^7", msgin);
                }
                else
                {
-                       msgstr = strcat("\{1}", namestr, "^7: ", msgin);
+                       msgstr = strcat("\{1}", colorprefix, namestr, "^7: ", msgin);
                        cmsgstr = "";
                }
                msgstr = strcat(strreplace("\n", " ", msgstr), "\n"); // newlines only are good for centerprint
index 2a51eed..7842448 100644 (file)
@@ -462,8 +462,9 @@ void ClientCommand_selectteam(float request, float argc)
                                                                        {
                                                                                if(autocvar_g_balance_teams && autocvar_g_balance_teams_prevent_imbalance)
                                                                                {
+                                                                                       CheckAllowedTeams(self);
                                                                                        GetTeamCounts(self);
-                                                                                       if(!TeamSmallerEqThanTeam(selection, self.team, self))
+                                                                                       if(!TeamSmallerEqThanTeam(Team_TeamToNumber(selection), Team_TeamToNumber(self.team), self))
                                                                                        {
                                                                                                sprint(self, "Cannot change to a larger/better/shinier team\n");
                                                                                                return;
index b897915..29e817e 100644 (file)
@@ -338,7 +338,7 @@ string getlsmaps()
        }
 
        MapInfo_ClearTemps();
-       return sprintf("^7Maps available%s: %s\n", (newmaps ? " (New maps have asterisks marked in blue)" : ""), lsmaps);
+       return sprintf("^7Maps available (%d)%s: %s\n", tokenize_console(lsmaps), (newmaps ? " (New maps have asterisks marked in blue)" : ""), lsmaps);
 }
 
 string getmonsterlist()
index 8d17bd1..c0da029 100644 (file)
@@ -1513,7 +1513,9 @@ void GameCommand_trace(float request, float argc)
                        {
                                case "debug":
                                {
+                                       float hitcount = 0;
                                        print("TEST CASE. If this returns the runaway loop counter error, possibly everything is oaky.\n");
+                                       float worst_endpos_bug = 0;
                                        for(;;)
                                        {
                                                org = world.mins;
@@ -1531,49 +1533,49 @@ void GameCommand_trace(float request, float argc)
                                                end = stov(vtos(end));
 
                                                tracebox(start, PL_MIN, PL_MAX, end, MOVE_NOMONSTERS, world);
-                                               if(!trace_startsolid)
+                                               if(!trace_startsolid && trace_fraction < 1)
                                                {
                                                        p = trace_endpos;
                                                        tracebox(p, PL_MIN, PL_MAX, p, MOVE_NOMONSTERS, world);
-                                                       if(trace_startsolid || trace_fraction == 1)
+                                                       if(trace_startsolid)
                                                        {
                                                                rint(42); // do an engine breakpoint on VM_rint so you can get the trace that errnoeously returns startsolid
                                                                tracebox(start, PL_MIN, PL_MAX, end, MOVE_NOMONSTERS, world);
 
-                                                               if(trace_startsolid)
+                                                               // how much do we need to back off?
+                                                               safe = 1;
+                                                               unsafe = 0;
+                                                               for(;;)
                                                                {
-                                                                       // how much do we need to back off?
-                                                                       safe = 1;
-                                                                       unsafe = 0;
-                                                                       for(;;)
+                                                                       pos = p * (1 - (safe + unsafe) * 0.5) + start * ((safe + unsafe) * 0.5);
+                                                                       tracebox(pos, PL_MIN, PL_MAX, pos, MOVE_NOMONSTERS, world);
+                                                                       if(trace_startsolid)
                                                                        {
-                                                                               pos = p * (1 - (safe + unsafe) * 0.5) + start * ((safe + unsafe) * 0.5);
-                                                                               tracebox(pos, PL_MIN, PL_MAX, pos, MOVE_NOMONSTERS, world);
-                                                                               if(trace_startsolid)
-                                                                               {
-                                                                                       if((safe + unsafe) * 0.5 == unsafe)
-                                                                                               break;
-                                                                                       unsafe = (safe + unsafe) * 0.5;
-                                                                               }
-                                                                               else
-                                                                               {
-                                                                                       if((safe + unsafe) * 0.5 == safe)
-                                                                                               break;
-                                                                                       safe = (safe + unsafe) * 0.5;
-                                                                               }
+                                                                               if((safe + unsafe) * 0.5 == unsafe)
+                                                                                       break;
+                                                                               unsafe = (safe + unsafe) * 0.5;
                                                                        }
-
-                                                                       print("safe distance to back off: ", ftos(safe * vlen(p - start)), "qu\n");
-                                                                       print("unsafe distance to back off: ", ftos(unsafe * vlen(p - start)), "qu\n");
-
-                                                                       tracebox(p, PL_MIN + '0.1 0.1 0.1', PL_MAX - '0.1 0.1 0.1', p, MOVE_NOMONSTERS, world);
-                                                                       if(trace_startsolid)
-                                                                               print("trace_endpos much in solid when tracing from ", vtos(start), " to ", vtos(end), " endpos ", vtos(p), "\n");
                                                                        else
-                                                                               print("trace_endpos just in solid when tracing from ", vtos(start), " to ", vtos(end), " endpos ", vtos(p), "\n");
-                                                                       break;
+                                                                       {
+                                                                               if((safe + unsafe) * 0.5 == safe)
+                                                                                       break;
+                                                                               safe = (safe + unsafe) * 0.5;
+                                                                       }
                                                                }
 
+                                                               print("safe distance to back off: ", ftos(safe * vlen(p - start)), "qu\n");
+                                                               print("unsafe distance to back off: ", ftos(unsafe * vlen(p - start)), "qu\n");
+
+                                                               tracebox(p, PL_MIN + '0.1 0.1 0.1', PL_MAX - '0.1 0.1 0.1', p, MOVE_NOMONSTERS, world);
+                                                               if(trace_startsolid)
+                                                                       print("trace_endpos much in solid when tracing from ", vtos(start), " to ", vtos(end), " endpos ", vtos(p), "\n");
+                                                               else
+                                                                       print("trace_endpos just in solid when tracing from ", vtos(start), " to ", vtos(end), " endpos ", vtos(p), "\n");
+                                                               if (++hitcount >= 10)
+                                                                       break;
+                                                       }
+                                                       else
+                                                       {
                                                                q0 = p;
                                                                dq = 0;
                                                                dqf = 1;
@@ -1590,11 +1592,13 @@ void GameCommand_trace(float request, float argc)
                                                                        dqf *= 0.5;
                                                                        q0 = q;
                                                                }
-                                                               if(dq > 0)
+                                                               if(dq > worst_endpos_bug)
                                                                {
+                                                                       worst_endpos_bug = dq;
                                                                        print("trace_endpos still before solid when tracing from ", vtos(start), " to ", vtos(end), " endpos ", vtos(p), "\n");
                                                                        print("could go ", ftos(dq), " units further to ", vtos(q), "\n");
-                                                                       break;
+                                                                       if (++hitcount >= 10)
+                                                                               break;
                                                                }
                                                        }
                                                }
index 45319ca..42dee6a 100644 (file)
@@ -1217,6 +1217,7 @@ void Fire_ApplyDamage(entity e)
        e.fire_hitsound = TRUE;
 
        if (!IS_INDEPENDENT_PLAYER(e))
+       if(!e.freezetag_frozen)
        FOR_EACH_PLAYER(other) if(e != other)
        {
                if(IS_PLAYER(other))
index 875a0c3..f635bff 100644 (file)
@@ -1576,7 +1576,7 @@ float InitiateSuddenDeath()
        // - for this timelimit_overtime needs to be >0 of course
        // - also check the winning condition calculated in the previous frame and only add normal overtime
        //   again, if at the point at which timelimit would be extended again, still no winner was found
-       if (!autocvar_g_campaign && (checkrules_overtimesadded >= 0) && (checkrules_overtimesadded < autocvar_timelimit_overtimes) && autocvar_timelimit_overtime && !(g_race && !g_race_qualifying))
+       if (!autocvar_g_campaign && (checkrules_overtimesadded >= 0) && (checkrules_overtimesadded < autocvar_timelimit_overtimes || autocvar_timelimit_overtimes < 0) && autocvar_timelimit_overtime && !(g_race && !g_race_qualifying))
        {
                return 1; // need to call InitiateOvertime later
        }
@@ -2730,6 +2730,8 @@ string GotoMap(string m)
 
 void EndFrame()
 {
+       anticheat_endframe();
+
        float altime;
        FOR_EACH_REALCLIENT(self)
        {
index 66c7b87..b841962 100644 (file)
@@ -656,7 +656,7 @@ void ctf_FlagThink()
        if(self.mins != FLAG_MIN || self.maxs != FLAG_MAX) { // reset the flag boundaries in case it got squished
                dprint("wtf the flag got squashed?\n");
                tracebox(self.origin, FLAG_MIN, FLAG_MAX, self.origin, MOVE_NOMONSTERS, self);
-               if(!trace_startsolid) // can we resize it without getting stuck?
+               if(!trace_startsolid || self.noalign) // can we resize it without getting stuck?
                        setsize(self, FLAG_MIN, FLAG_MAX); }
 
        switch(self.ctf_status) // reset flag angles in case warpzones adjust it
@@ -793,7 +793,7 @@ void ctf_FlagTouch()
        // special touch behaviors
        if(toucher.vehicle_flags & VHF_ISVEHICLE)
        {
-               if(autocvar_g_ctf_allow_vehicle_touch)
+               if(autocvar_g_ctf_allow_vehicle_touch && toucher.owner)
                        toucher = toucher.owner; // the player is actually the vehicle owner, not other
                else
                        return; // do nothing
index ec6ee8c..942682c 100644 (file)
@@ -25,28 +25,28 @@ void ka_RespawnBall() // runs whenever the ball needs to be relocated
        if(gameover) { return; }
        vector oldballorigin = self.origin;
 
-       if(MoveToRandomMapLocation(self, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, 10, 1024, 256))
+       if(!MoveToRandomMapLocation(self, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, 10, 1024, 256))
        {
-               makevectors(self.angles);
-               self.movetype = MOVETYPE_BOUNCE;
-               self.velocity = '0 0 200';
-               self.angles = '0 0 0';
-               self.effects = autocvar_g_keepawayball_effects;
-               self.think = ka_RespawnBall;
-               self.nextthink = time + autocvar_g_keepawayball_respawntime;
+               entity spot = SelectSpawnPoint(TRUE);
+               setorigin(self, spot.origin);
+               self.angles = spot.angles;
+       }
 
-               pointparticles(particleeffectnum("electro_combo"), oldballorigin, '0 0 0', 1);
-               pointparticles(particleeffectnum("electro_combo"), self.origin, '0 0 0', 1);
+       makevectors(self.angles);
+       self.movetype = MOVETYPE_BOUNCE;
+       self.velocity = '0 0 200';
+       self.angles = '0 0 0';
+       self.effects = autocvar_g_keepawayball_effects;
+       self.think = ka_RespawnBall;
+       self.nextthink = time + autocvar_g_keepawayball_respawntime;
 
-               WaypointSprite_Spawn("ka-ball", 0, 0, self, '0 0 64', world, self.team, self, waypointsprite_attachedforcarrier, FALSE, RADARICON_FLAGCARRIER, '0 1 1');
-               WaypointSprite_Ping(self.waypointsprite_attachedforcarrier);
+       pointparticles(particleeffectnum("electro_combo"), oldballorigin, '0 0 0', 1);
+       pointparticles(particleeffectnum("electro_combo"), self.origin, '0 0 0', 1);
 
-               sound(self, CH_TRIGGER, "keepaway/respawn.wav", VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
-       }
-       else
-       {
-               ka_RespawnBall(); // finding a location failed, retry
-       }
+       WaypointSprite_Spawn("ka-ball", 0, 0, self, '0 0 64', world, self.team, self, waypointsprite_attachedforcarrier, FALSE, RADARICON_FLAGCARRIER, '0 1 1');
+       WaypointSprite_Ping(self.waypointsprite_attachedforcarrier);
+
+       sound(self, CH_TRIGGER, "keepaway/respawn.wav", VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
 }
 
 void ka_TimeScoring()
@@ -102,7 +102,8 @@ void ka_TouchEvent() // runs any time that the ball comes in contact with someth
        // messages and sounds
        ka_EventLog("pickup", other);
        Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_KEEPAWAY_PICKUP, other.netname);
-       Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_KEEPAWAY_PICKUP, other.netname);
+       Send_Notification(NOTIF_ALL_EXCEPT, other, MSG_CENTER, CENTER_KEEPAWAY_PICKUP, other.netname);
+       Send_Notification(NOTIF_ONE, other, MSG_CENTER, CENTER_KEEPAWAY_PICKUP_SELF);
        sound(self.owner, CH_TRIGGER, "keepaway/pickedup.wav", VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
 
        // scoring
index 2d2c857..014d37e 100644 (file)
@@ -457,11 +457,21 @@ void nb_spawnteams(void)
        }
 }
 
+// scoreboard setup
+void nb_ScoreRules(float teams)
+{
+       ScoreRules_basics(teams, 0, 0, TRUE);
+       ScoreInfo_SetLabel_TeamScore(   ST_NEXBALL_GOALS,  "goals", SFL_SORT_PRIO_PRIMARY);
+       ScoreInfo_SetLabel_PlayerScore( SP_NEXBALL_GOALS,  "goals", SFL_SORT_PRIO_PRIMARY);
+       ScoreInfo_SetLabel_PlayerScore(SP_NEXBALL_FAULTS, "faults", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER);
+       ScoreRules_basics_end();
+}
+
 void nb_delayedinit(void)
 {
        if(find(world, classname, "nexball_team") == world)
                nb_spawnteams();
-       ScoreRules_nexball(nb_teams);
+       nb_ScoreRules(nb_teams);
 }
 
 
@@ -471,11 +481,7 @@ void nb_delayedinit(void)
 
 void SpawnBall(void)
 {
-       if(!g_nexball)
-       {
-               remove(self);
-               return;
-       }
+       if(!g_nexball) { remove(self); return; }
 
 //     balls += 4; // using the remaining bits to count balls will leave more than the max edict count, so it's fine
 
@@ -559,14 +565,28 @@ void spawnfunc_nexball_football(void)
        SpawnBall();
 }
 
+float nb_Goal_Customize()
+{
+       entity e, wp_owner;
+       e = WaypointSprite_getviewentity(other);
+       wp_owner = self.owner;
+       if(SAME_TEAM(e, wp_owner)) { return FALSE; }
+
+       return TRUE;
+}
+
 void SpawnGoal(void)
 {
-       if(!g_nexball)
+       if(!g_nexball) { remove(self); return; }
+
+       EXACTTRIGGER_INIT;
+
+       if(self.team != GOAL_OUT && Team_TeamToNumber(self.team) != -1)
        {
-               remove(self);
-               return;
+               WaypointSprite_SpawnFixed("goal", (self.absmin + self.absmax) * 0.5, self, sprite, RADARICON_NONE, ((self.team) ? Team_ColorRGB(self.team) : '1 0.5 0'));
+               self.sprite.customizeentityforclient = nb_Goal_Customize;
        }
-       EXACTTRIGGER_INIT;
+
        self.classname = "nexball_goal";
        if(self.noise == "")
                self.noise = "ctf/respawn.wav";
@@ -674,7 +694,7 @@ void W_Nexball_Touch(void)
 
        PROJECTILE_TOUCH;
        if(attacker.team != other.team || autocvar_g_nexball_basketball_teamsteal)
-               if((ball = other.ballcarried) && (IS_PLAYER(attacker)))
+               if((ball = other.ballcarried) && !other.deadflag && (IS_PLAYER(attacker)))
                {
                        other.velocity = other.velocity + normalize(self.velocity) * other.damageforcescale * autocvar_g_balance_nexball_secondary_force;
                        other.flags &= ~FL_ONGROUND;
@@ -683,7 +703,7 @@ void W_Nexball_Touch(void)
                                LogNB("stole", attacker);
                                sound(other, CH_TRIGGER, ball.noise2, VOL_BASE, ATTEN_NORM);
 
-                               if(attacker.team == other.team && time > attacker.teamkill_complain)
+                               if(SAME_TEAM(attacker, other) && time > attacker.teamkill_complain)
                                {
                                        attacker.teamkill_complain = time + 5;
                                        attacker.teamkill_soundtime = time + 0.4;
@@ -760,7 +780,7 @@ void W_Nexball_Attack2(void)
        missile.movetype = MOVETYPE_FLY;
        PROJECTILE_MAKETRIGGER(missile);
 
-       setmodel(missile, "models/elaser.mdl");  // precision set below
+       //setmodel(missile, "models/elaser.mdl");  // precision set below
        setsize(missile, '0 0 0', '0 0 0');
        setorigin(missile, w_shotorg);
 
@@ -772,6 +792,8 @@ void W_Nexball_Attack2(void)
 
        missile.effects = EF_BRIGHTFIELD | EF_LOWPRECISION;
        missile.flags = FL_PROJECTILE;
+
+       CSQCProjectile(missile, TRUE, PROJECTILE_ELECTRO, TRUE);
 }
 
 float ball_customize()
@@ -859,18 +881,6 @@ MUTATOR_HOOKFUNCTION(nexball_BallDrop)
        return 0;
 }
 
-MUTATOR_HOOKFUNCTION(nexball_BuildMutatorsString)
-{
-       ret_string = strcat(ret_string, ":NB");
-       return 0;
-}
-
-MUTATOR_HOOKFUNCTION(nexball_BuildMutatorsPrettyString)
-{
-       ret_string = strcat(ret_string, ", NexBall");
-       return 0;
-}
-
 MUTATOR_HOOKFUNCTION(nexball_PlayerPreThink)
 {
        makevectors(self.v_angle);
@@ -947,6 +957,16 @@ MUTATOR_HOOKFUNCTION(nexball_PlayerSpawn)
        return FALSE;
 }
 
+MUTATOR_HOOKFUNCTION(nexball_PlayerPhysics)
+{
+       if(self.ballcarried)
+       {
+               self.stat_sv_airspeedlimit_nonqw *= autocvar_g_nexball_basketball_carrier_highspeed;
+               self.stat_sv_maxspeed *= autocvar_g_nexball_basketball_carrier_highspeed;
+       }
+       return FALSE;
+}
+
 MUTATOR_HOOKFUNCTION(nexball_SetStartItems)
 {
        start_items |= IT_UNLIMITED_SUPERWEAPONS; // FIXME BAD BAD BAD BAD HACK, NEXBALL SHOULDN'T ABUSE PORTO'S WEAPON SLOT
@@ -954,16 +974,34 @@ MUTATOR_HOOKFUNCTION(nexball_SetStartItems)
        return FALSE;
 }
 
+MUTATOR_HOOKFUNCTION(nexball_ForbidThrowing)
+{
+       if(self.weapon == WEP_GRENADE_LAUNCHER)
+               return TRUE;
+
+       return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(nexball_FilterItem)
+{
+       if(self.classname == "droppedweapon")
+       if(self.weapon == WEP_GRENADE_LAUNCHER)
+               return TRUE;
+
+       return FALSE;
+}
+
 MUTATOR_DEFINITION(gamemode_nexball)
 {
        MUTATOR_HOOK(PlayerDies, nexball_BallDrop, CBC_ORDER_ANY);
        MUTATOR_HOOK(MakePlayerObserver, nexball_BallDrop, CBC_ORDER_ANY);
        MUTATOR_HOOK(ClientDisconnect, nexball_BallDrop, CBC_ORDER_ANY);
-       MUTATOR_HOOK(BuildMutatorsPrettyString, nexball_BuildMutatorsPrettyString, CBC_ORDER_ANY);
-       MUTATOR_HOOK(BuildMutatorsString, nexball_BuildMutatorsString, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerSpawn, nexball_PlayerSpawn, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerPreThink, nexball_PlayerPreThink, CBC_ORDER_ANY);
+       MUTATOR_HOOK(PlayerPhysics, nexball_PlayerPhysics, CBC_ORDER_ANY);
        MUTATOR_HOOK(SetStartItems, nexball_SetStartItems, CBC_ORDER_ANY);
+       MUTATOR_HOOK(ForbidThrowCurrentWeapon, nexball_ForbidThrowing, CBC_ORDER_ANY);
+       MUTATOR_HOOK(FilterItem, nexball_FilterItem, CBC_ORDER_ANY);
 
        MUTATOR_ONADD
        {
@@ -973,6 +1011,8 @@ MUTATOR_DEFINITION(gamemode_nexball)
                g_nexball_meter_period = rint(g_nexball_meter_period * 32) / 32; //Round to 1/32ths to send as a byte multiplied by 32
                addstat(STAT_NB_METERSTART, AS_FLOAT, metertime);
 
+               w_porto(WR_PRECACHE); // abuse
+
                // General settings
                /*
                CVTOV(g_nexball_football_boost_forward);   //100
index 54df3a9..e53c80f 100644 (file)
@@ -41,6 +41,7 @@ MUTATOR_HOOKFUNCTION(msnt_Spawn_Score)
 
 MUTATOR_HOOKFUNCTION(msnt_PlayerSpawn)
 {
+       // Note: when entering this, fixangle is already set.
        if(autocvar_g_spawn_near_teammate_ignore_spawnpoint)
        {
                if(autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay_death)
@@ -112,7 +113,6 @@ MUTATOR_HOOKFUNCTION(msnt_PlayerSpawn)
                                                                                setorigin(self, trace_endpos);
                                                                                self.angles = team_mate.angles;
                                                                                self.angles_z = 0; // never spawn tilted even if the spot says to
-                                                                               self.fixangle = TRUE; // turn this way immediately
                                                                                team_mate.msnt_timer = time + autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay;
                                                                                return 0;
                                                                        }
@@ -130,7 +130,6 @@ MUTATOR_HOOKFUNCTION(msnt_PlayerSpawn)
                        setorigin(self, best_spot);
                        self.angles = best_mate.angles;
                        self.angles_z = 0; // never spawn tilted even if the spot says to
-                       self.fixangle = TRUE; // turn this way immediately
                        best_mate.msnt_timer = time + autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay;
                }
        }
@@ -139,7 +138,6 @@ MUTATOR_HOOKFUNCTION(msnt_PlayerSpawn)
                self.angles = vectoangles(spawn_spot.msnt_lookat.origin - self.origin);
                self.angles_x = -self.angles_x;
                self.angles_z = 0; // never spawn tilted even if the spot says to
-               self.fixangle = TRUE; // turn this way immediately
                /*
                sprint(self, "You should be looking at ", spawn_spot.msnt_lookat.netname, "^7.\n");
                sprint(self, "distance: ", vtos(spawn_spot.msnt_lookat.origin - self.origin), "\n");
index 2c6e941..3186b1a 100644 (file)
@@ -5,6 +5,26 @@ string events_last;
 .float playerstats_addedglobalinfo;
 .string playerstats_id;
 
+#define ALL_ANTICHEATS \
+       ANTICHEAT("_time"); \
+       ANTICHEAT("speedhack"); \
+       ANTICHEAT("speedhack_m1"); \
+       ANTICHEAT("speedhack_m2"); \
+       ANTICHEAT("speedhack_m3"); \
+       ANTICHEAT("speedhack_m4"); \
+       ANTICHEAT("speedhack_m5"); \
+       ANTICHEAT("div0_strafebot_old"); \
+       ANTICHEAT("div0_strafebot_new"); \
+       ANTICHEAT("div0_evade"); \
+       ANTICHEAT("idle_snapaim"); \
+       ANTICHEAT("idle_snapaim_signal"); \
+       ANTICHEAT("idle_snapaim_noise"); \
+       ANTICHEAT("idle_snapaim_m2"); \
+       ANTICHEAT("idle_snapaim_m3"); \
+       ANTICHEAT("idle_snapaim_m4"); \
+       ANTICHEAT("idle_snapaim_m7"); \
+       ANTICHEAT("idle_snapaim_m10");
+
 void PlayerStats_Init() // initiated before InitGameplayMode so that scores are added properly
 {
        string uri;
@@ -44,6 +64,11 @@ void PlayerStats_Init() // initiated before InitGameplayMode so that scores are
         PlayerStats_AddEvent(strcat("acc-", w.netname, "-frags"));
     }
 
+#define ANTICHEAT(name) \
+       PlayerStats_AddEvent("anticheat-" name)
+       ALL_ANTICHEATS
+#undef ANTICHEAT
+
        PlayerStats_AddEvent(PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_3);
        PlayerStats_AddEvent(PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_5);
        PlayerStats_AddEvent(PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_10);
@@ -356,6 +381,18 @@ void PlayerStats_Accuracy(entity p)
     //backtrace(strcat("adding player stat accuracy for ", p.netname, ".\n"));
 }
 
+void PlayerStats_Anticheat(entity p)
+{
+       entity oldself = self;
+       self = p;
+
+#define ANTICHEAT(name) \
+       PlayerStats_Event(p, "anticheat-" name, anticheat_getvalue(name))
+       ALL_ANTICHEATS
+#undef ANTICHEAT
+       self = oldself;
+}
+
 void PlayerStats_AddGlobalInfo(entity p)
 {
        if(playerstats_db < 0)
@@ -384,6 +421,8 @@ void PlayerStats_AddGlobalInfo(entity p)
 
        PlayerStats_Accuracy(p);
 
+       PlayerStats_Anticheat(p);
+
        if(IS_REAL_CLIENT(p))
        {
                if(p.latency_cnt)
@@ -430,3 +469,5 @@ void PlayerStats_EndMatch(float finished)
                }
        }
 }
+
+#undef ALL_ANTICHEATS
index 920f738..73e733b 100644 (file)
@@ -238,6 +238,8 @@ void StartFrame (void)
        FOR_EACH_PLAYER(self)
                self.porto_forbidden = max(0, self.porto_forbidden - 1);
 
+       anticheat_startframe();
+
        MUTATOR_CALLHOOK(SV_StartFrame);
 }
 
index 8f15a4f..6e7c35b 100644 (file)
@@ -338,6 +338,12 @@ void spawnfunc_trigger_teleport (void)
 void WarpZone_PostTeleportPlayer_Callback(entity pl)
 {
        UpdateCSQCProjectileAfterTeleport(pl);
+       {
+               entity oldself = self;
+               self = pl;
+               anticheat_fixangle();
+               self = oldself;
+       }
        // "disown" projectiles after teleport
        if(pl.owner)
        if(pl.owner == pl.realowner)
index 769416c..600af86 100644 (file)
@@ -28,8 +28,12 @@ void target_music_use()
 {
        if(!activator)
                return;
+       if(!IS_REAL_CLIENT(activator))
+               return;
        msg_entity = activator;
        target_music_sendto(MSG_ONE, 1);
+       entity head;
+       FOR_EACH_SPEC(head) if(head.enemy == activator) { msg_entity = head; target_music_sendto(MSG_ONE, 1); }
 }
 void spawnfunc_target_music()
 {
index 5d88df8..ec36f5d 100644 (file)
@@ -195,7 +195,7 @@ void W_Mine_Think (void)
 
        // a player's mines shall explode if he disconnects or dies
        // TODO: Do this on team change too -- Samual: But isn't a player killed when they switch teams?
-       if(!IS_PLAYER(self.realowner) || self.realowner.deadflag != DEAD_NO)
+       if(!IS_PLAYER(self.realowner) || self.realowner.deadflag != DEAD_NO || self.realowner.freezetag_frozen)
        {
                other = world;
                self.projectiledeathtype |= HITTYPE_BOUNCE;
@@ -207,7 +207,7 @@ void W_Mine_Think (void)
        head = findradius(self.origin, autocvar_g_balance_minelayer_proximityradius);
        while(head)
        {
-               if(IS_PLAYER(head) && head.deadflag == DEAD_NO)
+               if(IS_PLAYER(head) && head.deadflag == DEAD_NO && !head.freezetag_frozen)
                if(head != self.realowner && DIFF_TEAM(head, self.realowner)) // don't trigger for team mates
                if(!self.mine_time)
                {