]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into terencehill/ca_bots_fix
authorterencehill <piuntn@gmail.com>
Tue, 29 Nov 2016 18:22:07 +0000 (19:22 +0100)
committerterencehill <piuntn@gmail.com>
Tue, 29 Nov 2016 18:22:07 +0000 (19:22 +0100)
Conflicts:
qcsrc/server/mutators/mutator/gamemode_lms.qc

91 files changed:
.gitlab-ci.yml
_hud_common.cfg
bal-wep-xonotic.cfg
bal-wep-xpm.cfg
defaultXonotic.cfg
minigames.cfg
monsters.cfg
mutators.cfg
physics.cfg
qcsrc/client/autocvars.qh
qcsrc/client/hud/hud.qc
qcsrc/client/hud/hud.qh
qcsrc/client/hud/panel/healtharmor.qc
qcsrc/client/hud/panel/infomessages.qc
qcsrc/client/hud/panel/scoreboard.qc
qcsrc/client/miscfunctions.qc
qcsrc/client/teamradar.qc
qcsrc/client/teamradar.qh
qcsrc/client/view.qc
qcsrc/common/_all.inc
qcsrc/common/constants.qh
qcsrc/common/minigames/minigame/bd.qc
qcsrc/common/minigames/minigame/snake.qc
qcsrc/common/monsters/monster.qh
qcsrc/common/monsters/monster/zombie.qh
qcsrc/common/monsters/sv_spawn.qc
qcsrc/common/mutators/mutator/buffs/sv_buffs.qc
qcsrc/common/mutators/mutator/damagetext/damagetext.qc
qcsrc/common/mutators/mutator/dodging/sv_dodging.qc
qcsrc/common/mutators/mutator/nades/nades.qc
qcsrc/common/mutators/mutator/spawn_near_teammate/sv_spawn_near_teammate.qc
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc
qcsrc/common/notifications/all.qh
qcsrc/common/physics/movetypes/movetypes.qc
qcsrc/common/physics/player.qc
qcsrc/common/physics/player.qh
qcsrc/common/playerstats.qc
qcsrc/common/playerstats.qh
qcsrc/common/state.qc
qcsrc/common/t_items.qc
qcsrc/common/t_items.qh
qcsrc/common/turrets/cl_turrets.qc
qcsrc/common/turrets/config.qc
qcsrc/common/util.qc
qcsrc/common/util.qh
qcsrc/common/vehicles/vehicle/bumblebee_weapons.qh
qcsrc/common/vehicles/vehicle/racer.qc
qcsrc/common/vehicles/vehicle/racer_weapon.qh
qcsrc/common/vehicles/vehicle/raptor_weapons.qh
qcsrc/common/vehicles/vehicle/spiderbot.qc
qcsrc/common/vehicles/vehicle/spiderbot_weapons.qh
qcsrc/common/weapons/all.qh
qcsrc/common/weapons/weapon.qh
qcsrc/common/weapons/weapon/tuba.qc
qcsrc/ecs/lib.qh
qcsrc/ecs/systems/physics.qc
qcsrc/ecs/systems/sv_physics.qc
qcsrc/lib/_all.inc
qcsrc/lib/math.qh
qcsrc/lib/self.qh
qcsrc/lib/spawnfunc.qh
qcsrc/lib/warpzone/mathlib.qc
qcsrc/lib/warpzone/mathlib.qh
qcsrc/menu/item/image.qc
qcsrc/menu/item/listbox.qc
qcsrc/menu/xonotic/checkbox.qc
qcsrc/menu/xonotic/dialog_multiplayer_create_mutators.qc
qcsrc/menu/xonotic/screenshotimage.qc
qcsrc/menu/xonotic/serverlist.qc
qcsrc/menu/xonotic/slider_decibels.qc
qcsrc/server/anticheat.qc
qcsrc/server/anticheat.qh
qcsrc/server/bot/default/havocbot/havocbot.qc
qcsrc/server/bot/default/scripting.qc
qcsrc/server/client.qc
qcsrc/server/command/cmd.qh
qcsrc/server/command/radarmap.qc
qcsrc/server/command/sv_cmd.qc
qcsrc/server/command/vote.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/events.qh
qcsrc/server/mutators/mutator/gamemode_ca.qh
qcsrc/server/mutators/mutator/gamemode_domination.qc
qcsrc/server/mutators/mutator/gamemode_freezetag.qc
qcsrc/server/mutators/mutator/gamemode_invasion.qc
qcsrc/server/mutators/mutator/gamemode_keyhunt.qc
qcsrc/server/mutators/mutator/gamemode_lms.qc
qcsrc/server/mutators/mutator/gamemode_lms.qh
qcsrc/server/pathlib/main.qc
qcsrc/server/player.qc
qcsrc/server/round_handler.qc

index 3c4126b01d23bcbf383052bdaaffb6592f85ef32..70b0200061236faed47346a6b163ae103efb482b 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=93decd0a82cf911f02fb5572197db7f3
+    - EXPECT=04d63df6a5d73bd335612543efd944d6
     - HASH=$(${ENGINE} -noconfig -nohome +exec serverbench.cfg
       | tee /dev/stderr
       | grep '^:'
index c7befdd232dd79479a9c2a7b54c81120e9708150..2e8d64da5ae99f8ed274600eda2f73520151fa44 100644 (file)
@@ -108,7 +108,7 @@ seta hud_panel_infomessages_group_time 6 "number of seconds a message of a group
 seta hud_panel_infomessages_group_fadetime 0.4 "group message fade in/out time"
 
 seta hud_panel_scoreboard_namesize 15 "size limit of player names and relative column (multiplied by fontsize)"
-seta hud_panel_scoreboard_maxheight 0.5 "max height of the scoreboard; a few players that wouldn't fit into the scoreboard are listed in the last row"
+seta hud_panel_scoreboard_maxheight 0.6 "max height of the scoreboard; a few players that wouldn't fit into the scoreboard are listed in the last row"
 seta hud_panel_scoreboard_others_showscore 1 "show scores of players listed in the last row when the scoreboard reaches the max height"
 seta hud_panel_scoreboard_spectators_showping 1 "show ping of spectators"
 seta hud_panel_scoreboard_spectators_aligned 0 "align spectators in columns"
index 9e1f4cb5ed7596d6c22659ef11759adeb2390661..57b632be48c98ac1bfef777c1deb0773f4d8ab36 100644 (file)
@@ -456,7 +456,7 @@ set g_balance_vaporizer_switchdelay_raise 0.2
 set g_balance_vaporizer_weaponreplace ""
 set g_balance_vaporizer_weaponstart 0
 set g_balance_vaporizer_weaponstartoverride -1
-set g_balance_vaporizer_weaponthrowable 0
+set g_balance_vaporizer_weaponthrowable 1
 // }}}
 // {{{ #13: Grappling Hook
 set g_balance_hook_primary_ammo 5
index 9e1f4cb5ed7596d6c22659ef11759adeb2390661..57b632be48c98ac1bfef777c1deb0773f4d8ab36 100644 (file)
@@ -456,7 +456,7 @@ set g_balance_vaporizer_switchdelay_raise 0.2
 set g_balance_vaporizer_weaponreplace ""
 set g_balance_vaporizer_weaponstart 0
 set g_balance_vaporizer_weaponstartoverride -1
-set g_balance_vaporizer_weaponthrowable 0
+set g_balance_vaporizer_weaponthrowable 1
 // }}}
 // {{{ #13: Grappling Hook
 set g_balance_hook_primary_ammo 5
index 3f3cf443514fd2382b2722cda894d290da501b0f..8ed6aa1aec6aa4ad9acf6ab18bfc04c5b9656827 100644 (file)
@@ -36,6 +36,8 @@ alias +hook +button6
 alias -hook -button6
 alias +jetpack +button10
 alias -jetpack -button10
+alias +dodge +button11
+alias -dodge -button11
 alias use "impulse 21"
 
 // for backwards compatibility
@@ -235,6 +237,11 @@ seta cl_eventchase_maxs "12 12 8" "max size of eventchase camera bbox"
 seta cl_eventchase_mins "-12 -12 -8" "min size of eventchase camera bbox"
 seta cl_eventchase_viewoffset "0 0 20" "viewoffset of eventchase camera"
 seta cl_eventchase_generator_viewoffset "0 0 80" "viewoffset of eventchase camera while viewing generator explosion"
+seta cl_eventchase_vehicle 1 "camera goes into 3rd person mode when inside a vehicle"
+seta cl_eventchase_vehicle_viewoffset "0 0 80"
+seta cl_eventchase_vehicle_distance 250
+
+set _vehicles_shownchasemessage 0
 
 //nifreks lockonrestart feature, used in team-based game modes, if set to 1 and all players readied up no other player can then join the game anymore, useful to block spectators from joining
 set teamplay_lockonrestart 0 "lock teams once all players readied up and the game restarted (no new players can join after restart unless using the server-command unlockteams)"
@@ -782,7 +789,8 @@ seta g_waypointsprite_turrets_maxdist 5000 "max distace for turret sprites"
 seta g_waypointsprite_tactical 1 "tactical overlay on turrets when in a vehicle"
 
 seta cl_damagetext "1" "Draw damage dealt where you hit the enemy"
-seta cl_damagetext_format "-{total}" "How to format the damage text. {health}, {armor}, {total}, {potential}: full damage not capped to target's health, {potential_health}: health damage not capped to target's health, {health(ph)}: shows potential_health too if different from health, {total(p)}: shows potential too if different from total"
+seta cl_damagetext_format "-{total}" "How to format the damage text. {health}, {armor}, {total}, {potential}: full damage not capped to target's health, {potential_health}: health damage not capped to target's health"
+seta cl_damagetext_format_verbose 0 "{health} shows {potential_health} too when they differ; {total} shows {potential} too when they differ"
 seta cl_damagetext_color "1 1 0" "Damage text color"
 seta cl_damagetext_color_per_weapon "0" "Damage text uses weapon color"
 seta cl_damagetext_size "8" "Damage text font size"
@@ -795,6 +803,13 @@ seta cl_damagetext_accumulate_alpha_rel "0.65" "Only update existing damage text
 seta cl_damagetext_friendlyfire "1" "Show damage text for friendlyfire too"
 seta cl_damagetext_friendlyfire_color "1 0 0" "Damage text color for friendlyfire"
 
+seta cl_vehicles_alarm 1 "Play an alarm sound when the vehicle you are driving is heavily damaged"
+seta cl_vehicles_hud_tactical 1
+seta cl_vehicles_hudscale 0.5
+seta cl_vehicles_notify_time 15
+seta cl_vehicles_crosshair_size 0.5
+seta cl_vehicles_crosshair_colorize 1
+
 set sv_itemstime 1 "enable networking of time left until respawn for items such as mega health/armor and powerups"
 
 // so it can be stuffcmd-ed still
@@ -1220,6 +1235,10 @@ set _campaign_testrun 0 "To verify the campaign file, set this to 1, then start
 // debug
 set _independent_players 0 "DO NOT TOUCH"
 set _notarget 0 "NO, REALLY, DON'T"
+set debugdraw 0
+set debugdraw_filter ""
+set debugdraw_filterout ""
+set debugtrace 0
 
 // define some engine cvars that we need even on dedicated server
 set r_showbboxes 0
@@ -1375,8 +1394,12 @@ set g_frozen_revive_falldamage_health 40 "Amount of health player has if they re
 set g_frozen_damage_trigger 1 "if 1, frozen players falling into the void will die instead of teleporting to spawn"
 set g_frozen_force 0.6 "How much to multiply the force on a frozen player with"
 
-// player statistics server URI
+// player statistics
 set g_playerstats_gamereport_uri "http://stats.xonotic.org/stats/submit" "Output player statistics information to either: URL (with ://), console (with a dash like this: -), or supply a filename to output to data directory."
+set g_playerstats_gamereport_ladder ""
+set g_playerstats_playerbasic_uri "http://stats.xonotic.org"
+set g_playerstats_playerdetail_uri "http://stats.xonotic.org/player/me"
+set g_playerstats_playerdetail_autoupdatetime 1800 // automatically update every 30 minutes anyway
 
 // autoscreenshots
 set g_max_info_autoscreenshot 3 "how many info_autoscreenshot entities are allowed"
index 4be8cf69bb9ce4d0737cfd1c7d05f94ec0850fd6..8e70653bb205cd497447bb84b89a8ff17ba19854 100644 (file)
@@ -20,3 +20,7 @@ set sv_minigames_snake_delay_initial 0.7 "Initial delay between snake movement"
 set sv_minigames_snake_delay_multiplier 50 "Multiplier of incremental of movement speed (player_score / cvar)"
 set sv_minigames_snake_delay_min 0.1 "Minimum delay between snake movement (at fastest rate)"
 set sv_minigames_snake_lives 3
+
+
+// Bulldozer
+set sv_minigames_bulldozer_startlevel "level1"
index 1c87a716da1773d8dcbcac3a15e603464bcc59d7..ac6039041f5f3e98f492f8263ce48b6a490b901e 100644 (file)
@@ -111,4 +111,7 @@ set g_monsters_respawn_delay 20
 set g_monsters_max 20
 set g_monsters_max_perplayer 0
 set g_monsters_armor_blockpercent 0.5
+set g_monsters_damageforcescale 0.8
+set g_monsters_quake_resize 1
+set g_monsters_healthbars 0
 // }}}
index b5e9b76df68c7dcc9a962a191b19fe54b63a997e..0031904599c7997f7e4b6340719254ea3e5e7993 100644 (file)
@@ -428,6 +428,8 @@ seta cl_multijump 1 "allow multijump mutator"
 set g_multijump 0      "Number of multiple jumps to allow (jumping again in the air), -1 allows for infinite jumps"
 set g_multijump_add 0  "0 = make the current z velocity equal to jumpvelocity, 1 = add jumpvelocity to the current z velocity"
 set g_multijump_speed -999999  "Minimum vertical speed a player must have in order to jump again"
+set g_multijump_maxspeed 0
+set g_multijump_dodging 1
 
 
 // ===========
@@ -438,3 +440,12 @@ set g_walljump_delay 1 "Minimum delay between wall jumps"
 set g_walljump_force 300 "How far to bounce/jump off the wall"
 set g_walljump_velocity_xy_factor 1.15 "How much to slow down along horizontal axis, higher value = higher deceleration, if factor is < 1, you accelerate by wall jumping"
 set g_walljump_velocity_z_factor 0.5 "Upwards velocity factor, multiplied by normal jump velocity"
+
+
+// ===============
+//  global forces
+// ===============
+set g_globalforces 0 "Global forces: knockback affects everyone"
+set g_globalforces_noself 1 "Global forces: ignore self damage"
+set g_globalforces_self 1 "Global forces: knockback self scale"
+set g_globalforces_range 1000 "Global forces: max range of effect"
index 92fccaa42854ce67fef60c5cf5eb8ba4f5b0da45..1a38a7f617ad8f82d439ea85062c08f64a30b886 100644 (file)
@@ -272,3 +272,32 @@ set g_physics_bones_stopspeed 100
 set g_physics_bones_airaccelerate 1
 set g_physics_bones_airstopaccelerate 2.5
 set g_physics_bones_track_canjump 0
+
+// ==========
+//  Overkill
+// ==========
+set g_physics_overkill_airaccel_qw -0.8
+set g_physics_overkill_airstrafeaccel_qw -0.95
+set g_physics_overkill_airspeedlimit_nonqw 900
+set g_physics_overkill_maxspeed 400
+set g_physics_overkill_jumpvelocity 260
+set g_physics_overkill_maxairstrafespeed 100
+set g_physics_overkill_maxairspeed 360
+set g_physics_overkill_airstrafeaccelerate 24
+set g_physics_overkill_warsowbunny_turnaccel 0
+set g_physics_overkill_airaccel_qw_stretchfactor 2
+set g_physics_overkill_airaccel_sideways_friction 0
+set g_physics_overkill_aircontrol 125
+set g_physics_overkill_aircontrol_power 2
+set g_physics_overkill_aircontrol_backwards 0
+set g_physics_overkill_aircontrol_penalty 180
+set g_physics_overkill_warsowbunny_airforwardaccel 1.00001
+set g_physics_overkill_warsowbunny_topspeed 925
+set g_physics_overkill_warsowbunny_accel 0.1593
+set g_physics_overkill_warsowbunny_backtosideratio 0.8
+set g_physics_overkill_friction 8
+set g_physics_overkill_accelerate 15
+set g_physics_overkill_stopspeed 100
+set g_physics_overkill_airaccelerate 2
+set g_physics_overkill_airstopaccelerate 3
+set g_physics_overkill_track_canjump 0
index 33d1bc21320bee9ca676b8a35405050620af6bf4..193b7ef7cae691955478d714797e2b41206e9dd9 100644 (file)
@@ -122,7 +122,7 @@ string autocvar_crosshair_hitindication_per_weapon_color;
 float autocvar_crosshair_hitindication_speed;
 bool autocvar_crosshair_hittest;
 bool autocvar_crosshair_hittest_blur;
-float autocvar_crosshair_hittest_scale = 1.25;
+//float autocvar_crosshair_hittest_scale = 1.25;
 bool autocvar_crosshair_hittest_showimpact;
 bool autocvar_crosshair_per_weapon;
 float autocvar_crosshair_pickup;
@@ -208,7 +208,7 @@ bool autocvar_hud_panel_engineinfo_dynamichud   = true;
 bool autocvar_hud_panel_infomessages_dynamichud = false;
 bool autocvar_hud_panel_physics_dynamichud      = true;
 bool autocvar_hud_panel_centerprint_dynamichud  = true;
-bool autocvar_hud_panel_itemstime_dynamichud    = true;
+//bool autocvar_hud_panel_itemstime_dynamichud    = true;
 bool autocvar_hud_panel_healtharmor_hide_ondeath  = false;
 bool autocvar_hud_panel_ammo_hide_ondeath         = false;
 bool autocvar_hud_panel_powerups_hide_ondeath     = false;
@@ -442,13 +442,5 @@ float autocvar_cl_deathglow;
 bool autocvar_developer_csqcentities;
 float autocvar_g_jetpack_attenuation;
 bool autocvar_cl_showspectators;
-string autocvar_crosshair_hmg = "";
-vector autocvar_crosshair_hmg_color = '0.2 1.0 0.2';
-float autocvar_crosshair_hmg_alpha = 1;
-float autocvar_crosshair_hmg_size = 1;
-string autocvar_crosshair_rpc = "";
-vector autocvar_crosshair_rpc_color = '0.2 1.0 0.2';
-float autocvar_crosshair_rpc_alpha = 1;
-float autocvar_crosshair_rpc_size = 1;
 int autocvar_cl_nade_timer;
 bool autocvar_r_drawviewmodel;
index c89fe08bc4f5f269298cf6c9d692ab2b8f8f2caa..ee94af72705e032158b5139980e91a18429a087e 100644 (file)
@@ -22,34 +22,34 @@ Misc HUD functions
 ==================
 */
 
-vector HUD_Get_Num_Color (float x, float maxvalue)
+vector HUD_Get_Num_Color (float hp, float maxvalue)
 {
        float blinkingamt;
        vector color;
-       if(x >= maxvalue) {
+       if(hp >= maxvalue) {
                color.x = sin(2*M_PI*time);
                color.y = 1;
                color.z = sin(2*M_PI*time);
        }
-       else if(x > maxvalue * 0.75) {
-               color.x = 0.4 - (x-150)*0.02 * 0.4; //red value between 0.4 -> 0
-               color.y = 0.9 + (x-150)*0.02 * 0.1; // green value between 0.9 -> 1
+       else if(hp > maxvalue * 0.75) {
+               color.x = 0.4 - (hp-150)*0.02 * 0.4; //red value between 0.4 -> 0
+               color.y = 0.9 + (hp-150)*0.02 * 0.1; // green value between 0.9 -> 1
                color.z = 0;
        }
-       else if(x > maxvalue * 0.5) {
-               color.x = 1 - (x-100)*0.02 * 0.6; //red value between 1 -> 0.4
-               color.y = 1 - (x-100)*0.02 * 0.1; // green value between 1 -> 0.9
-               color.z = 1 - (x-100)*0.02; // blue value between 1 -> 0
+       else if(hp > maxvalue * 0.5) {
+               color.x = 1 - (hp-100)*0.02 * 0.6; //red value between 1 -> 0.4
+               color.y = 1 - (hp-100)*0.02 * 0.1; // green value between 1 -> 0.9
+               color.z = 1 - (hp-100)*0.02; // blue value between 1 -> 0
        }
-       else if(x > maxvalue * 0.25) {
+       else if(hp > maxvalue * 0.25) {
                color.x = 1;
                color.y = 1;
-               color.z = 0.2 + (x-50)*0.02 * 0.8; // blue value between 0.2 -> 1
+               color.z = 0.2 + (hp-50)*0.02 * 0.8; // blue value between 0.2 -> 1
        }
-       else if(x > maxvalue * 0.1) {
+       else if(hp > maxvalue * 0.1) {
                color.x = 1;
-               color.y = (x-20)*90/27/100; // green value between 0 -> 1
-               color.z = (x-20)*90/27/100 * 0.2; // blue value between 0 -> 0.2
+               color.y = (hp-20)*90/27/100; // green value between 0 -> 1
+               color.z = (hp-20)*90/27/100 * 0.2; // blue value between 0 -> 0.2
        }
        else {
                color.x = 1;
@@ -57,7 +57,7 @@ vector HUD_Get_Num_Color (float x, float maxvalue)
                color.z = 0;
        }
 
-       blinkingamt = (1 - x/maxvalue/0.25);
+       blinkingamt = (1 - hp/maxvalue/0.25);
        if(blinkingamt > 0)
        {
                color.x = color.x - color.x * blinkingamt * sin(2*M_PI*time);
@@ -303,7 +303,7 @@ void HUD_Panel_DrawHighlight(vector pos, vector mySize, vector color, float theA
        drawsubpic(pos + eX * mySize.x - eX * min(mySize.x * 0.5, mySize.y), eX * min(mySize.x * 0.5, mySize.y) + eY * mySize.y, pic, '0.75 0 0', '0.25 1 0', color, theAlpha, drawflag);
 }
 
-void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, bool vertical, int icon_right_align, vector color, float theAlpha, float fadelerp)
+void DrawNumIcon_expanding(vector myPos, vector mySize, float theTime, string icon, bool vertical, int icon_right_align, vector color, float theAlpha, float fadelerp)
 {
     TC(bool, vertical); TC(int, icon_right_align);
        vector newPos = '0 0 0', newSize = '0 0 0';
@@ -345,7 +345,7 @@ void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, bo
                // reduce only y to draw numbers with different number of digits with the same y size
                numpos.y += newSize.y * ((1 - 0.7) / 2);
                newSize.y *= 0.7;
-               drawstring_aspect(numpos, ftos(x), newSize, color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL);
+               drawstring_aspect(numpos, ftos(theTime), newSize, color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL);
                return;
        }
 
@@ -379,14 +379,14 @@ void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, bo
 
        // NOTE: newSize_x is always equal to 3 * mySize_y so we can use
        // '2 1 0' * newSize_y instead of eX * (2/3) * newSize_x + eY * newSize_y
-       drawstring_aspect_expanding(numpos, ftos(x), '2 1 0' * newSize.y, color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, fadelerp);
+       drawstring_aspect_expanding(numpos, ftos(theTime), '2 1 0' * newSize.y, color, panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, fadelerp);
        drawpic_aspect_skin_expanding(picpos, icon, '1 1 0' * newSize.y, '1 1 1', panel_fg_alpha * theAlpha, DRAWFLAG_NORMAL, fadelerp);
 }
 
-void DrawNumIcon(vector myPos, vector mySize, float x, string icon, bool vertical, int icon_right_align, vector color, float theAlpha)
+void DrawNumIcon(vector myPos, vector mySize, float theTime, string icon, bool vertical, int icon_right_align, vector color, float theAlpha)
 {
     TC(bool, vertical); TC(int, icon_right_align);
-       DrawNumIcon_expanding(myPos, mySize, x, icon, vertical, icon_right_align, color, theAlpha, 0);
+       DrawNumIcon_expanding(myPos, mySize, theTime, icon, vertical, icon_right_align, color, theAlpha, 0);
 }
 
 /*
index 4cd0ee88e32e0a1e50ae67920994b277dfb0feae..06a34911453f3a8120a89171ab237e1283dd2172 100644 (file)
@@ -48,9 +48,9 @@ float HUD_Radar_InputEvent(float bInputType, float nPrimary, float nSecondary);
 void HUD_Radar_Hide_Maximized();
 
 float HUD_GetRowCount(int item_count, vector size, float item_aspect);
-vector HUD_Get_Num_Color (float x, float maxvalue);
-void DrawNumIcon(vector myPos, vector mySize, float x, string icon, bool vertical, bool icon_right_align, vector color, float theAlpha);
-void DrawNumIcon_expanding(vector myPos, vector mySize, float x, string icon, bool vertical, int icon_right_align, vector color, float theAlpha, float fadelerp);
+vector HUD_Get_Num_Color (float hp, float maxvalue);
+void DrawNumIcon(vector myPos, vector mySize, float theTime, string icon, bool vertical, bool icon_right_align, vector color, float theAlpha);
+void DrawNumIcon_expanding(vector myPos, vector mySize, float theTime, string icon, bool vertical, int icon_right_align, vector color, float theAlpha, float fadelerp);
 void HUD_Panel_DrawHighlight(vector pos, vector mySize, vector color, float theAlpha, int drawflag);
 vector HUD_GetTableSize_BestItemAR(int item_count, vector psize, float item_aspect);
 
index 7f5e4c1709c8486a1d591d7703a31ec5c4c963ad..4fad2c7c43c56342337764cc1fa323b2791a6248 100644 (file)
@@ -86,8 +86,7 @@ void HUD_HealthArmor()
                vector v;
                v = healtharmor_maxdamage(health, armor, armorblockpercent, DEATH_WEAPON.m_id);
 
-               float x;
-               x = floor(v.x + 1);
+               float hp = floor(v.x + 1);
 
         float maxtotal = maxhealth + maxarmor;
                string biggercount;
@@ -95,7 +94,7 @@ void HUD_HealthArmor()
                {
                        biggercount = "health";
                        if(autocvar_hud_panel_healtharmor_progressbar)
-                               HUD_Panel_DrawProgressBar(pos, mySize, autocvar_hud_panel_healtharmor_progressbar_health, x/maxtotal, 0, (baralign == 1 || baralign == 2), autocvar_hud_progressbar_health_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                               HUD_Panel_DrawProgressBar(pos, mySize, autocvar_hud_panel_healtharmor_progressbar_health, hp/maxtotal, 0, (baralign == 1 || baralign == 2), autocvar_hud_progressbar_health_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                        if(armor)
             if(autocvar_hud_panel_healtharmor_text)
                                drawpic_aspect_skin(pos + eX * mySize.x - eX * 0.5 * mySize.y, "armor", '0.5 0.5 0' * mySize.y, '1 1 1', panel_fg_alpha * armor / health, DRAWFLAG_NORMAL);
@@ -104,13 +103,13 @@ void HUD_HealthArmor()
                {
                        biggercount = "armor";
                        if(autocvar_hud_panel_healtharmor_progressbar)
-                               HUD_Panel_DrawProgressBar(pos, mySize, autocvar_hud_panel_healtharmor_progressbar_armor, x/maxtotal, 0, (baralign == 1 || baralign == 2), autocvar_hud_progressbar_armor_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                               HUD_Panel_DrawProgressBar(pos, mySize, autocvar_hud_panel_healtharmor_progressbar_armor, hp/maxtotal, 0, (baralign == 1 || baralign == 2), autocvar_hud_progressbar_armor_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                        if(health)
             if(autocvar_hud_panel_healtharmor_text)
                                drawpic_aspect_skin(pos + eX * mySize.x - eX * 0.5 * mySize.y, "health", '0.5 0.5 0' * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
                }
         if(autocvar_hud_panel_healtharmor_text)
-                       DrawNumIcon(pos, mySize, x, biggercount, 0, iconalign, HUD_Get_Num_Color(x, maxtotal), 1);
+                       DrawNumIcon(pos, mySize, hp, biggercount, 0, iconalign, HUD_Get_Num_Color(hp, maxtotal), 1);
 
                if(fuel)
                        HUD_Panel_DrawProgressBar(pos, eX * mySize.x + eY * 0.2 * mySize.y, "progressbar", fuel/100, 0, (baralign == 1 || baralign == 3), autocvar_hud_progressbar_fuel_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
index cd49f09adc769bc0a5cd66450e8178b04a943e4c..db102e60e8b6fb7fb17d6223a8268fbb20025fc5 100644 (file)
@@ -114,7 +114,7 @@ void HUD_InfoMessages()
                                InfoMessage(s);
                        }
 
-                       if(gametype == MAPINFO_TYPE_LMS)
+                       if(!warmup_stage && gametype == MAPINFO_TYPE_LMS)
                        {
                                entity sk;
                                sk = playerslots[player_localnum];
index 994ff12aa59e4c6ca25a63591638d1e30397b458..35de2196b96fb3d3b1f1a464bf73df5de4a7b456 100644 (file)
@@ -31,14 +31,14 @@ float sbt_highlight_alpha_self;
 
 // provide basic panel cvars to old clients
 // TODO remove them after a future release (0.8.2+)
-string autocvar_hud_panel_scoreboard_pos = "0.150000 0.150000";
-string autocvar_hud_panel_scoreboard_size = "0.700000 0.700000";
-string autocvar_hud_panel_scoreboard_bg = "border_default";
-string autocvar_hud_panel_scoreboard_bg_color = "0 0.3 0.5";
-string autocvar_hud_panel_scoreboard_bg_color_team = "";
-string autocvar_hud_panel_scoreboard_bg_alpha = "0.7";
-string autocvar_hud_panel_scoreboard_bg_border = "";
-string autocvar_hud_panel_scoreboard_bg_padding = "";
+noref string autocvar_hud_panel_scoreboard_pos = "0.150000 0.150000";
+noref string autocvar_hud_panel_scoreboard_size = "0.700000 0.700000";
+noref string autocvar_hud_panel_scoreboard_bg = "border_default";
+noref string autocvar_hud_panel_scoreboard_bg_color = "0 0.3 0.5";
+noref string autocvar_hud_panel_scoreboard_bg_color_team = "";
+noref string autocvar_hud_panel_scoreboard_bg_alpha = "0.7";
+noref string autocvar_hud_panel_scoreboard_bg_border = "";
+noref string autocvar_hud_panel_scoreboard_bg_padding = "";
 
 float autocvar_hud_panel_scoreboard_fadeinspeed = 10;
 float autocvar_hud_panel_scoreboard_fadeoutspeed = 5;
@@ -59,7 +59,7 @@ bool autocvar_hud_panel_scoreboard_accuracy_nocolors = false;
 
 bool autocvar_hud_panel_scoreboard_dynamichud = false;
 
-float autocvar_hud_panel_scoreboard_maxheight = 0.5;
+float autocvar_hud_panel_scoreboard_maxheight = 0.6;
 bool autocvar_hud_panel_scoreboard_others_showscore = true;
 bool autocvar_hud_panel_scoreboard_spectators_showping = true;
 bool autocvar_hud_panel_scoreboard_spectators_aligned = false;
@@ -670,7 +670,7 @@ string Scoreboard_GetField(entity pl, PlayerScoreField field)
                case SP_DMG: case SP_DMGTAKEN:
                        return sprintf("%.1f k", pl.(scores(field)) / 1000);
 
-               default:
+               default: case SP_SCORE:
                        tmp = pl.(scores(field));
                        f = scores_flags(field);
                        if(field == ps_primary)
@@ -951,7 +951,7 @@ vector Scoreboard_DrawOthers(vector item_pos, vector rgb, int this_team, entity
                                field = Scoreboard_GetField(pl, SP_PING);
                }
                else if(autocvar_hud_panel_scoreboard_others_showscore)
-                       field = ftos(pl.(scores(ps_primary)));
+                       field = Scoreboard_GetField(pl, SP_SCORE);
 
                string str = textShortenToWidth(entcs_GetName(pl.sv_entnum), namesize, hud_fontsize, stringwidth_colors);
                float column_width = stringwidth(str, true, hud_fontsize);
@@ -1009,10 +1009,16 @@ vector Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_size)
        int max_players = 999;
        if(autocvar_hud_panel_scoreboard_maxheight > 0)
        {
-               max_players = autocvar_hud_panel_scoreboard_maxheight * vid_conheight;
+               float height = autocvar_hud_panel_scoreboard_maxheight * vid_conheight;
                if(teamplay)
-                       max_players = (max_players - hud_fontsize.y * 1.25 - panel_bg_padding * 2) / 2;
-               max_players = floor(max_players / (hud_fontsize.y * 1.25));
+               {
+                       height -= (panel_bg_padding * 2 + hud_fontsize.y * 1.25) * team_count; // - padding and header
+                       height -= hud_fontsize.y * (team_count - 1); // - spacing between tables
+                       height /= team_count;
+               }
+               else
+                       height -= panel_bg_padding * 2; // - padding
+               max_players = floor(height / (hud_fontsize.y * 1.25));
                if(max_players <= 1)
                        max_players = 1;
                if(max_players == tm.team_size)
index 0e88cd5a51043107b2d2246e79351151dccc538e..a0d7b8789c2273ad34ed1cbe9750a2eb795e205c 100644 (file)
@@ -389,15 +389,15 @@ void PolyDrawModel(entity e)
 
 void DrawCircleClippedPic(vector centre, float radi, string pic, float f, vector rgb, float a, float drawflag)
 {
-       float x, y, q, d;
+       float d;
        vector ringsize, v, t;
        ringsize = radi * '1 1 0';
 
-       x = cos(f * 2 * M_PI);
-       y = sin(f * 2 * M_PI);
-       q = fabs(x) + fabs(y);
-       x /= q;
-       y /= q;
+       float co = cos(f * 2 * M_PI);
+       float si = sin(f * 2 * M_PI);
+       float q = fabs(co) + fabs(si);
+       co /= q;
+       si /= q;
 
        if(f >= 1)
        {
@@ -530,8 +530,8 @@ void DrawCircleClippedPic(vector centre, float radi, string pic, float f, vector
        if(d > 0)
        {
                        v = centre;                     t = '0.5 0.5 0';
-                       v.x += x * 0.5 * ringsize.x;    t += x * '0.5 0.5 0';
-                       v.y += y * 0.5 * ringsize.y;    t += y * '0.5 -0.5 0';
+                       v.x += co * 0.5 * ringsize.x;   t += co * '0.5 0.5 0';
+                       v.y += si * 0.5 * ringsize.y;   t += si * '0.5 -0.5 0';
                        R_PolygonVertex(v, t, rgb, a);
                R_EndPolygon();
        }
index 9c4544bba08c0afce4ed04c14b8546d979da4d70..abd700e613e38895b44ceeba7acbe86498895b42 100644 (file)
@@ -49,12 +49,12 @@ vector teamradar_2dcoord_to_texcoord(vector in)
        return out;
 }
 
-vector teamradar_texcoord_to_3dcoord(vector in,float z)
+vector teamradar_texcoord_to_3dcoord(vector in,float oz)
 {
        vector out;
        out_x = in_x * (mi_picmax_x - mi_picmin_x) + mi_picmin_x;
        out_y = in_y * (mi_picmax_y - mi_picmin_y) + mi_picmin_y;
-       out_z = z;
+       out_z = oz;
        return out;
 }
 
index 0b1884ccf3a713d8c77488bd7d809dcf3d013cb3..251c1a53f12a9185f0c5274839479066a4d7e759 100644 (file)
@@ -32,7 +32,7 @@ vector teamradar_3dcoord_to_texcoord(vector in);
 
 vector teamradar_texcoord_to_2dcoord(vector in);
 
-vector teamradar_texcoord_to_3dcoord(vector in,float z);
+vector teamradar_texcoord_to_3dcoord(vector in,float oz);
 
 void draw_teamradar_background(float fg);
 
index 12f4c6a1d0e68e5b72ebb0a475d31c5dee265045..2ca531166a936555ce61bde93b471579ed3a9a10 100644 (file)
@@ -125,7 +125,6 @@ void calc_followmodel_ofs(entity view)
        float frac;
        vector gunorg = '0 0 0';
        static vector vel_average;
-       static vector gunorg_prev = '0 0 0';
        static vector gunorg_adjustment_highpass;
        static vector gunorg_adjustment_lowpass;
 
@@ -314,12 +313,9 @@ void viewmodel_draw(entity this)
        {
                static string name_last;
                string name = wep.mdl;
-               if(wep == WEP_TUBA)
-               {
-                       name = (this.tuba_instrument == 0) ? "tuba" :
-                          (this.tuba_instrument == 1) ? "akordeon" :
-                                                    "kleinbottle";
-               }
+               string newname = wep.wr_viewmodel(wep, this);
+               if(newname)
+                       name = newname;
                bool swap = name != name_last;
                // if (swap)
                {
@@ -826,8 +822,8 @@ void HitSound()
                        float a = autocvar_cl_hitsound_max_pitch;
                        float b = autocvar_cl_hitsound_min_pitch;
                        float c = autocvar_cl_hitsound_nom_damage;
-                       float x = unaccounted_damage;
-                       float pitch_shift = (b*x*(a-1) + a*c*(1-b)) / (x*(a-1) + c*(1-b));
+                       float d = unaccounted_damage;
+                       float pitch_shift = (b*d*(a-1) + a*c*(1-b)) / (d*(a-1) + c*(1-b));
 
                        // if sound variation is disabled, set pitch_shift to 1
                        if (autocvar_cl_hitsound == 1)
@@ -879,7 +875,7 @@ vector crosshair_getcolor(entity this, float health_stat)
 
                case 2: // crosshair_color_by_health
                {
-                       float x = health_stat;
+                       float hp = health_stat;
 
                        //x = red
                        //y = green
@@ -887,33 +883,33 @@ vector crosshair_getcolor(entity this, float health_stat)
 
                        wcross_color.z = 0;
 
-                       if(x > 200)
+                       if(hp > 200)
                        {
                                wcross_color.x = 0;
                                wcross_color.y = 1;
                        }
-                       else if(x > 150)
+                       else if(hp > 150)
                        {
-                               wcross_color.x = 0.4 - (x-150)*0.02 * 0.4;
-                               wcross_color.y = 0.9 + (x-150)*0.02 * 0.1;
+                               wcross_color.x = 0.4 - (hp-150)*0.02 * 0.4;
+                               wcross_color.y = 0.9 + (hp-150)*0.02 * 0.1;
                        }
-                       else if(x > 100)
+                       else if(hp > 100)
                        {
-                               wcross_color.x = 1 - (x-100)*0.02 * 0.6;
-                               wcross_color.y = 1 - (x-100)*0.02 * 0.1;
-                               wcross_color.z = 1 - (x-100)*0.02;
+                               wcross_color.x = 1 - (hp-100)*0.02 * 0.6;
+                               wcross_color.y = 1 - (hp-100)*0.02 * 0.1;
+                               wcross_color.z = 1 - (hp-100)*0.02;
                        }
-                       else if(x > 50)
+                       else if(hp > 50)
                        {
                                wcross_color.x = 1;
                                wcross_color.y = 1;
-                               wcross_color.z = 0.2 + (x-50)*0.02 * 0.8;
+                               wcross_color.z = 0.2 + (hp-50)*0.02 * 0.8;
                        }
-                       else if(x > 20)
+                       else if(hp > 20)
                        {
                                wcross_color.x = 1;
-                               wcross_color.y = (x-20)*90/27/100;
-                               wcross_color.z = (x-20)*90/27/100 * 0.2;
+                               wcross_color.y = (hp-20)*90/27/100;
+                               wcross_color.z = (hp-20)*90/27/100 * 0.2;
                        }
                        else
                        {
index 5177c9dfd17320b7a3bc4dfa577639a608637ba8..988413f7a9593f9e17efc9a51ad354ac823c71f4 100644 (file)
@@ -1,4 +1,4 @@
-float autocvar_net_connecttimeout = 30;
+noref float autocvar_net_connecttimeout = 30;
 
 #ifdef GAMEQC
 #include "anim.qc"
index f3acfed4e160eacdc64aa85a4a4dd469aa7bd833..910f34e326eaaed24ab4462ef31b5d8321bff4c8 100644 (file)
@@ -233,7 +233,7 @@ const int SPECIES_RESERVED = 15;
 const int FRAGS_PLAYER = 0;
 const int FRAGS_SPECTATOR = -666;
 const int FRAGS_LMS_LOSER = -616;
-const int FRAGS_PLAYER_NONSOLID = -616;
+const int FRAGS_PLAYER_NONSOLID = FRAGS_LMS_LOSER;
 // we can use this frags value for both
 
 // water levels
@@ -247,6 +247,7 @@ const int SERVERFLAG_ALLOW_FULLBRIGHT = 1;
 const int SERVERFLAG_TEAMPLAY = 2;
 const int SERVERFLAG_PLAYERSTATS = 4;
 
+#ifdef SVQC
 // FIXME/EXPLAINME: why? Mario: because
 vector autocvar_sv_player_maxs = '16 16 45';
 vector autocvar_sv_player_mins = '-16 -16 -24';
@@ -254,7 +255,8 @@ vector autocvar_sv_player_viewoffset = '0 0 20';
 vector autocvar_sv_player_crouch_maxs = '16 16 25';
 vector autocvar_sv_player_crouch_mins = '-16 -16 -24';
 vector autocvar_sv_player_crouch_viewoffset = '0 0 20';
-vector autocvar_sv_player_headsize = '24 24 12';
+//vector autocvar_sv_player_headsize = '24 24 12';
+#endif
 
 
 // a bit more constant
index 911d19d3709f3764d921cca763e36b262f31c7f2..09fae55d80ef2f08ab17d8097633646b1a641069 100644 (file)
@@ -47,7 +47,9 @@ const int BD_DIR_DN = 1;
 const int BD_DIR_LF = 2;
 const int BD_DIR_RT = 3;
 
+#ifdef SVQC
 string autocvar_sv_minigames_bulldozer_startlevel = "level1";
+#endif
 
 // find same game piece given its tile name
 entity bd_find_piece(entity minig, string tile, bool check_target)
index 7f0fdb2ff750aa61eb1ffd2b5d72c903cfd0d97a..3aedeb01632db8081faf98e3308738b51dcd45e5 100644 (file)
@@ -21,7 +21,9 @@ bool autocvar_sv_minigames_snake_wrap = false;
 float autocvar_sv_minigames_snake_delay_initial = 0.7;
 float autocvar_sv_minigames_snake_delay_multiplier = 50;
 float autocvar_sv_minigames_snake_delay_min = 0.1;
+#ifdef SVQC
 int autocvar_sv_minigames_snake_lives = 3;
+#endif
 
 .int snake_score;
 
index 2685e2fbced75be78c0402980f5a5acea84f9294..ab644988aa4d1192e60fde95bb97f28da642c0d3 100644 (file)
@@ -12,6 +12,7 @@ const int MON_FLAG_CRUSH = BIT(11); // monster can be stomped in special modes
 const int MON_FLAG_RIDE = BIT(12); // monster can be ridden in special modes
 const int MONSTER_SIZE_QUAKE = BIT(13);
 const int MONSTER_TYPE_PASSIVE = BIT(14); // doesn't target or chase enemies
+const int MONSTER_TYPE_UNDEAD = BIT(15); // monster is by most definitions a zombie (doesn't fully die unless gibbed)
 
 // entity properties of monsterinfo:
 .bool(int, entity actor, entity targ) monster_attackfunc;
index b52056e71d9d0b58fd394f4bac976dd5f45c4fec..d3c94cd4546724e1597daa8e4ec8af8caa715be6 100644 (file)
@@ -7,7 +7,7 @@ MODEL(MON_ZOMBIE, M_Model("zombie.dpm"));
 #endif
 
 CLASS(Zombie, Monster)
-    ATTRIB(Zombie, spawnflags, int, MON_FLAG_MELEE | MON_FLAG_RIDE);
+    ATTRIB(Zombie, spawnflags, int, MONSTER_TYPE_UNDEAD | MON_FLAG_MELEE | MON_FLAG_RIDE);
     ATTRIB(Zombie, mins, vector, '-18 -18 -25');
     ATTRIB(Zombie, maxs, vector, '18 18 47');
 #ifdef GAMEQC
index 6d9daa2964cbb4c6c5c1d4c25561e22fcf2c2731..497dee86664b54d644f405e4be5ea47fc01969e9 100644 (file)
@@ -69,7 +69,11 @@ entity spawnmonster (entity e, string monster, int monster_id, entity spawnedby,
        }
 
        // Monster_Spawn checks if monster is valid
-       Monster_Spawn(e, false, monster_id);
+       if(!Monster_Spawn(e, false, monster_id))
+       {
+               delete(e);
+               return NULL; // remove even if told not to, as we didn't spawn any kind of monster
+       }
 
        return e;
 }
index 5587da593796e32e6e6afee3d91d84ec4ac14a18..32c61eb6aa2a8cb5d0d5fdea98fdf333a7e82056 100644 (file)
@@ -424,9 +424,9 @@ void buff_Medic_Heal(entity this)
        });
 }
 
-float buff_Inferno_CalculateTime(float x, float offset_x, float offset_y, float intersect_x, float intersect_y, float base)
+float buff_Inferno_CalculateTime(float damg, float offset_x, float offset_y, float intersect_x, float intersect_y, float base)
 {
-       return offset_y + (intersect_y - offset_y) * logn(((x - offset_x) * ((base - 1) / intersect_x)) + 1, base);
+       return offset_y + (intersect_y - offset_y) * logn(((damg - offset_x) * ((base - 1) / intersect_x)) + 1, base);
 }
 
 // mutator hooks
@@ -826,7 +826,7 @@ MUTATOR_HOOKFUNCTION(buffs, PlayerPreThink)
        if(player.buffs & BUFF_MAGNET.m_itemid)
        {
                vector pickup_size;
-               IL_EACH(g_items, it.classname != "item_flag_team" && it.classname != "item_kh_key",
+               IL_EACH(g_items, it.itemdef,
                {
                        if(it.buffs)
                                pickup_size = '1 1 1' * autocvar_g_buffs_magnet_range_buff;
index b95cabb6ab7bfc0cc8d9debc9877660c08407dfa..7f2b740ba56aa6e1d654644406f4f5e656d583a3 100644 (file)
@@ -12,10 +12,12 @@ const int DTFLAG_NO_POTENTIAL = BIT(5);
 
 REGISTER_MUTATOR(damagetext, true);
 
-#if defined(CSQC) || defined(MENUQC)
+// || defined(MENUQC)
+#if defined(CSQC)
 // no translatable cvar description please
 AUTOCVAR_SAVE(cl_damagetext,                        bool,   true,       "Draw damage dealt where you hit the enemy");
-AUTOCVAR_SAVE(cl_damagetext_format,                 string, "-{total}", "How to format the damage text. {health}, {armor}, {total}, {potential}: full damage not capped to target's health, {potential_health}: health damage not capped to target's health, {health(ph)}: shows potential_health too if different from health, {total(p)}: shows potential too if different from total");
+AUTOCVAR_SAVE(cl_damagetext_format,                 string, "-{total}", "How to format the damage text. {health}, {armor}, {total}, {potential}: full damage not capped to target's health, {potential_health}: health damage not capped to target's health");
+AUTOCVAR_SAVE(cl_damagetext_format_verbose,         bool,   false,      "{health} shows {potential_health} too when they differ; {total} shows {potential} too when they differ");
 STATIC_INIT(DamageText_LegacyFormat) {
     if (strstrofs(autocvar_cl_damagetext_format, "{", 0) < 0) autocvar_cl_damagetext_format = "-{total}";
 }
@@ -74,19 +76,17 @@ CLASS(DamageText, Object)
             int potential_health = rint((this.m_potential_damage - this.m_armordamage) / DAMAGETEXT_PRECISION_MULTIPLIER);
 
             string s = autocvar_cl_damagetext_format;
-            s = strreplace("{health}", sprintf("%d", health), s);
             s = strreplace("{armor}",  sprintf("%d", rint(this.m_armordamage / DAMAGETEXT_PRECISION_MULTIPLIER)), s);
-            s = strreplace("{total}",  sprintf("%d", total), s);
             s = strreplace("{potential}",  sprintf("%d", potential), s);
             s = strreplace("{potential_health}",  sprintf("%d", potential_health), s);
 
-            s = strreplace("{health(ph)}", (
-                               (health == potential_health)
+            s = strreplace("{health}", (
+                               (health == potential_health || !autocvar_cl_damagetext_format_verbose)
                                ? sprintf("%d",      health)
                                : sprintf("%d (%d)", health, potential_health)
                ), s);
-            s = strreplace("{total(p)}", (
-                               (total == potential)
+            s = strreplace("{total}", (
+                               (total == potential || !autocvar_cl_damagetext_format_verbose)
                                ? sprintf("%d",      total)
                                : sprintf("%d (%d)", total, potential)
                ), s);
index d20814ce7c045f04390645e8b156842b5236338e..fb1502dbc2102d3ec5c24c91f8f4ca705e673281 100644 (file)
@@ -109,13 +109,13 @@ bool check_close_to_ground(entity this, float threshold)
        return IS_ONGROUND(this) ? true : false;
 }
 
-float PM_dodging_checkpressedkeys(entity this)
+bool PM_dodging_checkpressedkeys(entity this)
 {
        if(!PHYS_DODGING)
                return false;
 
-       float frozen_dodging = (PHYS_FROZEN(this) && PHYS_DODGING_FROZEN(this));
-       float frozen_no_doubletap = (frozen_dodging && !PHYS_DODGING_FROZEN_NODOUBLETAP);
+       bool frozen_dodging = (PHYS_FROZEN(this) && PHYS_DODGING_FROZEN(this));
+       bool frozen_no_doubletap = (frozen_dodging && !PHYS_DODGING_FROZEN_NODOUBLETAP);
 
        // first check if the last dodge is far enough back in time so we can dodge again
        if ((time - this.last_dodging_time) < PHYS_DODGING_DELAY)
@@ -138,7 +138,9 @@ float PM_dodging_checkpressedkeys(entity this)
                if(!(PHYS_DODGING_PRESSED_KEYS(this) & KEY_##BTN) || frozen_no_doubletap) {             \
                                tap_direction_##RESULT;                                                                                                 \
                                if ((time - this.last_##BTN##_KEY_time) < PHYS_DODGING_TIMEOUT(this) || frozen_no_doubletap)    \
-                                       dodge_detected = true;                                                                                                  \
+                                       dodge_detected = true;                                                                                          \
+                               if(PHYS_INPUT_BUTTON_DODGE(this))                                                                               \
+                                       dodge_detected = true;                                                                                          \
                                this.last_##BTN##_KEY_time = time;                                                                              \
                }
        X(x < 0, BACKWARD,      x--);
index 6ec9c23213f132f95e95993202b74494422f3ce2..c09e221e469ec96b7e912b3bc0491dd372cc68e7 100644 (file)
@@ -153,12 +153,14 @@ void DrawAmmoNades(vector myPos, vector mySize, bool draw_expanding, float expan
 REGISTER_MUTATOR(nades, cvar("g_nades"));
 
 .float nade_time_primed;
+.float nade_lifetime;
 
 .entity nade_spawnloc;
 
+
 void nade_timer_think(entity this)
 {
-       this.skin = 8 - (this.owner.wait - time) / (autocvar_g_nades_nade_lifetime / 10);
+       this.skin = 8 - (this.owner.wait - time) / (this.owner.nade_lifetime / 10);
        this.nextthink = time;
        if(!this.owner || wasfreed(this.owner))
                delete(this);
@@ -862,7 +864,7 @@ void nade_damage(entity this, entity inflictor, entity attacker, float damage, i
        if(this.health == this.max_health)
        {
                sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX));
-               this.nextthink = max(time + autocvar_g_nades_nade_lifetime, time);
+               this.nextthink = max(time + this.nade_lifetime, time);
                setthink(this, nade_beep);
        }
 
@@ -1048,6 +1050,7 @@ void spawn_held_nade(entity player, entity nowner, float ntime, int ntype, strin
        setthink(n, nade_beep);
        n.nextthink = max(n.wait - 3, time);
        n.projectiledeathtype = DEATH_NADE.m_id;
+       n.nade_lifetime = ntime;
 
        setmodel(fn, MDL_NADE_VIEW);
        .entity weaponentity = weaponentities[0]; // TODO: unhardcode
@@ -1218,7 +1221,7 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink)
        entity held_nade = player.nade;
        if (held_nade)
        {
-               player.nade_timer = bound(0, (time - held_nade.nade_time_primed) / autocvar_g_nades_nade_lifetime, 1);
+               player.nade_timer = bound(0, (time - held_nade.nade_time_primed) / held_nade.nade_lifetime, 1);
                // LOG_TRACEF("%d %d", player.nade_timer, time - held_nade.nade_time_primed);
                makevectors(player.angles);
                held_nade.velocity = player.velocity;
index e4b784371525776b05566d4cb521902701dcb8e0..5f11777c2352b69d0ed4152ab1668e18dae3005b 100644 (file)
@@ -87,6 +87,8 @@ MUTATOR_HOOKFUNCTION(spawn_near_teammate, PlayerSpawn)
                int tested = 0;
                FOREACH_CLIENT_RANDOM(IS_PLAYER(it), LAMBDA(
                        if (autocvar_g_spawn_near_teammate_ignore_spawnpoint_max && tested >= autocvar_g_spawn_near_teammate_ignore_spawnpoint_max) break;
+
+                       if (PHYS_INPUT_BUTTON_CHAT(it)) continue;
                        if (!SAME_TEAM(player, it)) continue;
                        if (autocvar_g_spawn_near_teammate_ignore_spawnpoint_check_health && it.health < autocvar_g_balance_health_regenstable) continue;
                        if (IS_DEAD(it)) continue;
index e7a33567b62227403780bb71320f25ea9f56bbc0..a26441ee6e425118186595bf4fdcc3479a2dfa7a 100644 (file)
@@ -475,13 +475,13 @@ void Draw_WaypointSprite(entity this)
 
     InterpolateOrigin_Do(this);
 
-    float t = entcs_GetTeam(player_localnum) + 1;
     string spriteimage = "";
 
     // choose the sprite
     switch (this.rule)
     {
         case SPRITERULE_SPECTATOR:
+            float t = entcs_GetTeam(player_localnum) + 1;
             if (!(
                 (autocvar_g_waypointsprite_itemstime == 1 && t == NUM_SPECTATOR + 1)
             || (autocvar_g_waypointsprite_itemstime == 2 && (t == NUM_SPECTATOR + 1 || warmup_stage || STAT(ITEMSTIME) == 2))
@@ -492,7 +492,7 @@ void Draw_WaypointSprite(entity this)
         case SPRITERULE_DEFAULT:
             if (this.team)
             {
-                if (this.team == t)
+                if (this.team == myteam + 1)
                     spriteimage = this.netname;
                 else
                     spriteimage = "";
@@ -501,9 +501,9 @@ void Draw_WaypointSprite(entity this)
                 spriteimage = this.netname;
             break;
         case SPRITERULE_TEAMPLAY:
-            if (t == NUM_SPECTATOR + 1)
+            if (myteam == NUM_SPECTATOR)
                 spriteimage = this.netname3;
-            else if (this.team == t)
+            else if (this.team == myteam + 1)
                 spriteimage = this.netname2;
             else
                 spriteimage = this.netname;
@@ -613,7 +613,7 @@ void Draw_WaypointSprite(entity this)
 
     float crosshairdistance = sqrt( pow(o.x - vid_conwidth/2, 2) + pow(o.y - vid_conheight/2, 2) );
 
-    t = waypointsprite_scale;
+    float t = waypointsprite_scale;
     a *= waypointsprite_alpha;
 
     {
index d2682a148f70c937ea202d0ed7e1b1822109b114..5e5fbf1d603a560eb07fa18f8c1312c4a2f89a1a 100644 (file)
@@ -200,8 +200,8 @@ GENERIC_COMMAND(dumpnotifs, "Dump all notifications into notifications_dump.txt"
        }
 }
 
-float autocvar_notification_debug = false;
 #ifdef NOTIFICATIONS_DEBUG
+bool autocvar_notification_debug = false;
 void Debug_Notification(string input)
 {
        switch (autocvar_notification_debug)
@@ -297,8 +297,10 @@ float autocvar_notification_show_sprees_info = 3; // 0 = off, 1 = target only, 2
 float autocvar_notification_show_sprees_info_newline = true;
 float autocvar_notification_show_sprees_info_specialonly = true;
 float autocvar_notification_errors_are_fatal = true;
+#ifdef SVQC
 float autocvar_notification_lifetime_runtime = 0.5;
 float autocvar_notification_lifetime_mapload = 10;
+#endif
 
 #ifdef SVQC
 .float FRAG_VERBOSE;
index 729928bf5b14fff939f22547dc35165c076d841f..f0df80cd5d52c044dd46563eb248ea976f3692ed 100644 (file)
@@ -510,9 +510,9 @@ void makevectors_matrix(vector myangles)  // AngleVectorsFLU
 {
        v_forward = v_right = v_up = '0 0 0';
 
-       float y = myangles.y * (M_PI * 2 / 360);
-       float sy = sin(y);
-       float cy = cos(y);
+       float yy = myangles.y * (M_PI * 2 / 360);
+       float sy = sin(yy);
+       float cy = cos(yy);
        float p = myangles.x * (M_PI * 2 / 360);
        float sp = sin(p);
        float cp = cos(p);
index b5635e0945e0625dce91d9877bdb67fe7ab32285..26454152270150477da3a12c6edb48c22d6be231 100644 (file)
@@ -481,15 +481,15 @@ float racecar_angle(float forward, float down)
                return ret * angle_mult;
 }
 
+#ifdef SVQC
 string specialcommand = "xwxwxsxsxaxdxaxdx1x ";
 .float specialcommand_pos;
 void SpecialCommand(entity this)
 {
-#ifdef SVQC
        if (!CheatImpulse(this, CHIMPULSE_GIVE_ALL.impulse))
                LOG_INFO("A hollow voice says \"Plugh\".\n");
-#endif
 }
+#endif
 
 bool PM_check_specialcommand(entity this, int buttons)
 {
index 5c0b104178b0a385ee2509f9aa814f0d2b1c705c..39cc573ee99d9bc96cff1177dd1b3c457d26cfa1 100644 (file)
@@ -121,6 +121,7 @@ STATIC_INIT(PHYS_INPUT_BUTTON_HOOK)
 #define PHYS_INPUT_BUTTON_PRYDON(s)         PHYS_INPUT_BUTTON_BUTTON_PRYDON(s)
 #define PHYS_INPUT_BUTTON_ZOOMSCRIPT(s)     PHYS_INPUT_BUTTON_BUTTON9(s)
 #define PHYS_INPUT_BUTTON_JETPACK(s)        PHYS_INPUT_BUTTON_BUTTON10(s)
+#define PHYS_INPUT_BUTTON_DODGE(s)                     PHYS_INPUT_BUTTON_BUTTON11(s)
 
 #ifdef CSQC
 STATIC_INIT(PHYS_INPUT_BUTTON_JETPACK)
@@ -128,6 +129,12 @@ STATIC_INIT(PHYS_INPUT_BUTTON_JETPACK)
        localcmd("alias +jetpack +button10\n");
     localcmd("alias -jetpack -button10\n");
 }
+
+STATIC_INIT(PHYS_INPUT_BUTTON_DODGE)
+{
+    localcmd("alias +dodge +button11\n");
+    localcmd("alias -dodge -button11\n");
+}
 #endif
 
 // if more buttons are needed, start using impulse bits as buttons
index 4dab61164e4b3f7e94b6a2880df0f1d232269e9d..b879b63b09587a8846ec9bf910154b796c4cfab3 100644 (file)
@@ -5,9 +5,10 @@
     #include "constants.qh"
     #include "util.qh"
     #include <common/weapons/_all.qh>
-    #include "../server/weapons/accuracy.qh"
+    #include "../server/anticheat.qh"
     #include "../server/defs.qh"
     #include "../server/scores.qh"
+    #include "../server/weapons/accuracy.qh"
 #endif
 
 #ifdef SVQC
@@ -141,6 +142,7 @@ void PlayerStats_GameReport_FinalizePlayer(entity p)
                PS_GR_P_ADDVAL(p, PLAYERSTATS_JOINS, 1);
 
        PlayerStats_GameReport_Accuracy(p);
+       anticheat_report_to_playerstats(p);
 
        if(IS_REAL_CLIENT(p))
        {
@@ -249,6 +251,8 @@ void PlayerStats_GameReport_Init() // initiated before InitGameplayMode so that
                PlayerStats_GameReport_AddEvent(PLAYERSTATS_ACHIEVEMENT_BOTLIKE);
                PlayerStats_GameReport_AddEvent(PLAYERSTATS_ACHIEVEMENT_FIRSTBLOOD);
                PlayerStats_GameReport_AddEvent(PLAYERSTATS_ACHIEVEMENT_FIRSTVICTIM);
+
+               anticheat_register_to_playerstats();
        }
        else { PlayerStats_GameReport_DelayMapVote = false; }
 }
index 73496ba7639bd1b168b54c60fce009e2dbdd9916..1fafb13978dc9c43c1467ff3accb10089c55b6ad 100644 (file)
@@ -40,6 +40,7 @@ const string PLAYERSTATS_SCOREBOARD_POS = "scoreboardpos";
 
 const string PLAYERSTATS_TOTAL = "total-";
 const string PLAYERSTATS_SCOREBOARD = "scoreboard-";
+const string PLAYERSTATS_ANTICHEAT = "anticheat-";
 
 const string PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_3 = "achievement-kill-spree-3";
 const string PLAYERSTATS_ACHIEVEMENT_KILL_SPREE_5 = "achievement-kill-spree-5";
index 891461c6a4dd24f92886c1c89522af11e67f2093..1a2fb1e7bfb171bb0405c1f8a02f83f09bde43dd 100644 (file)
@@ -63,7 +63,7 @@ void ClientState_attach(entity this)
 
 void bot_clientdisconnect(entity this);
 void W_HitPlotClose(entity this);
-void anticheat_report(entity this);
+void anticheat_report_to_eventlog(entity this);
 void playerdemo_shutdown(entity this);
 void entcs_detach(entity this);
 void accuracy_free(entity this);
@@ -80,7 +80,7 @@ void ClientState_detach(entity this)
     bot_clientdisconnect(this);
 
     W_HitPlotClose(this);
-    anticheat_report(this);
+    anticheat_report_to_eventlog(this);
     playerdemo_shutdown(this);
     entcs_detach(this);
     accuracy_free(this);
index 3a7aea729e945ae59ac1c6c6f5e5104b15c2eb47..2f1a4c3aa6b7e4087a9de95a8136ade2204d54a5 100644 (file)
@@ -82,6 +82,11 @@ void ItemDraw(entity this)
                 if(this.ItemStatus & ITS_ANIMATE2)
                     this.avelocity = '0 -90 0';
             }
+
+            // delay is for blocking item's position for a while;
+            // it's a workaround for dropped weapons that receive the position
+            // another time right after they spawn overriding animation position
+            this.onground_time = time + 0.5;
         }
     }
     else if (autocvar_cl_animate_items)
@@ -89,13 +94,15 @@ void ItemDraw(entity this)
         if(this.ItemStatus & ITS_ANIMATE1)
         {
             this.angles += this.avelocity * frametime;
-            setorigin(this, '0 0 10' + this.oldorigin + '0 0 8' * sin(time * 2));
+            float fade_in = bound(0, time - this.onground_time, 1);
+            setorigin(this, this.oldorigin + fade_in * ('0 0 10' + '0 0 8' * sin((time - this.onground_time) * 2)));
         }
 
         if(this.ItemStatus & ITS_ANIMATE2)
         {
             this.angles += this.avelocity * frametime;
-            setorigin(this, '0 0 8' + this.oldorigin + '0 0 4' * sin(time * 3));
+            float fade_in = bound(0, time - this.onground_time, 1);
+            setorigin(this, this.oldorigin + fade_in * ('0 0 8' + '0 0 4' * sin((time - this.onground_time) * 3)));
         }
     }
 
@@ -831,7 +838,7 @@ LABEL(pickup)
                        RandomSelection_Init();
                        IL_EACH(g_items, it.team == this.team,
                        {
-                               if(it.classname != "item_flag_team" && it.classname != "item_kh_key")
+                               if(it.itemdef) // is a registered item
                                {
                                        Item_Show(it, -1);
                                        RandomSelection_AddEnt(it, it.cnt, 0);
@@ -875,7 +882,7 @@ void Item_FindTeam(entity this)
                RandomSelection_Init();
                IL_EACH(g_items, it.team == this.team,
                {
-                       if(it.classname != "item_flag_team" && it.classname != "item_kh_key")
+                       if(it.itemdef) // is a registered item
                                RandomSelection_AddEnt(it, it.cnt, 0);
                });
 
@@ -885,7 +892,7 @@ void Item_FindTeam(entity this)
 
                IL_EACH(g_items, it.team == this.team,
                {
-                       if(it.classname != "item_flag_team" && it.classname != "item_kh_key")
+                       if(it.itemdef) // is a registered item
                        {
                                if(it != e)
                                {
@@ -1789,6 +1796,7 @@ float GiveItems(entity e, float beginarg, float endarg)
        });
        POSTGIVE_VALUE(e, strength_finished, 1, SND_POWERUP, SND_POWEROFF);
        POSTGIVE_VALUE(e, invincible_finished, 1, SND_Shield, SND_POWEROFF);
+       //POSTGIVE_VALUE(e, superweapons_finished, 1, SND_Null, SND_Null);
        POSTGIVE_VALUE(e, ammo_nails, 0, SND_ITEMPICKUP, SND_Null);
        POSTGIVE_VALUE(e, ammo_cells, 0, SND_ITEMPICKUP, SND_Null);
        POSTGIVE_VALUE(e, ammo_plasma, 0, SND_ITEMPICKUP, SND_Null);
index f2308c35767756933f7c9c49be74e3668d79a2f5..418ce391767f4ff170a27f315ffbe953bab91d1a 100644 (file)
@@ -20,6 +20,7 @@ const int ISF_SIZE                            = BIT(7);
 
 .int ItemStatus;
 
+.float onground_time;
 .float fade_start;
 .float fade_end;
 
index c21e327d4470655336e6033d1823587c65f6e458..48c6a8798981269b18d83e41c1351f0b23d41640 100644 (file)
@@ -67,13 +67,12 @@ void turret_draw2d(entity this)
                return;
 
        float dist = vlen(this.origin - view_origin);
-       float t = (entcs_GetTeam(player_localnum) + 1);
 
        vector o;
        string txt;
 
        if(autocvar_cl_vehicles_hud_tactical)
-       if(dist < 10240 && t != this.team)
+       if(dist < 10240 && (myteam + 1 != this.team))
        {
                // TODO: Vehicle tactical hud
                o = project_3d_to_2d(this.origin + '0 0 32');
@@ -121,7 +120,7 @@ void turret_draw2d(entity this)
        else
                txt = spritelookuptext(this, spriteimage);
 
-       if(time - floor(time) > 0.5 && t == this.team)
+       if(time - floor(time) > 0.5 && (myteam + 1 == this.team))
        {
                if(this.helpme && time < this.helpme)
                {
@@ -163,7 +162,7 @@ void turret_draw2d(entity this)
 
        float crosshairdistance = sqrt( pow(o.x - vid_conwidth/2, 2) + pow(o.y - vid_conheight/2, 2) );
 
-       t = waypointsprite_scale;
+       float t = waypointsprite_scale;
        a *= waypointsprite_alpha;
 
        {
index 2b1e00c8a7d29d9db05b175bd357b4547786c480..68cac084649dba3baa49ae258a438d25313d5444 100644 (file)
@@ -28,12 +28,12 @@ float T_Config_Queue_Compare(float root, float child, entity pass)
 
 void Dump_Turret_Settings()
 {
-       float x, totalsettings = 0;
+       int totalsettings = 0;
        FOREACH(Turrets, it != TUR_Null, {
                // step 1: clear the queue
                TUR_CONFIG_COUNT = 0;
-               for(x = 0; x <= MAX_TUR_CONFIG; ++x)
-                       { tur_config_queue[x] = string_null; }
+               for(int j = 0; j <= MAX_TUR_CONFIG; ++j)
+                       { tur_config_queue[j] = string_null; }
 
                // step 2: build new queue
                it.tr_config(it);
@@ -43,8 +43,8 @@ void Dump_Turret_Settings()
 
                // step 4: write queue
                TUR_CONFIG_WRITETOFILE(sprintf("// {{{ #%d: %s\n", i, it.turret_name))
-               for(x = 0; x <= TUR_CONFIG_COUNT; ++x)
-                       { TUR_CONFIG_WRITETOFILE(tur_config_queue[x]) }
+               for(int j = 0; j <= TUR_CONFIG_COUNT; ++j)
+                       { TUR_CONFIG_WRITETOFILE(tur_config_queue[j]) }
                TUR_CONFIG_WRITETOFILE("// }}}\n")
 
                // step 5: debug info
@@ -54,8 +54,8 @@ void Dump_Turret_Settings()
 
        // clear queue now that we're finished
        TUR_CONFIG_COUNT = 0;
-       for(x = 0; x <= MAX_TUR_CONFIG; ++x)
-               { tur_config_queue[x] = string_null; }
+       for(int j = 0; j <= MAX_TUR_CONFIG; ++j)
+               { tur_config_queue[j] = string_null; }
 
        // extra information
        LOG_INFO(sprintf("Totals: %d turrets, %d settings\n", (Turrets_COUNT - 1), totalsettings));
index 87636d24e8446fddd1566e1b6c2e5edf9601e428..d83871080d1f19167fd803096f8ef03efd2cb11f 100644 (file)
@@ -228,13 +228,13 @@ string ScoreString(int pFlags, float pValue)
 
 float lengthLogTable[128];
 
-float invertLengthLog(float x)
+float invertLengthLog(float dist)
 {
        int l, r, m;
 
-       if(x >= lengthLogTable[127])
+       if(dist >= lengthLogTable[127])
                return 127;
-       if(x <= lengthLogTable[0])
+       if(dist <= lengthLogTable[0])
                return 0;
 
        l = 0;
@@ -243,15 +243,15 @@ float invertLengthLog(float x)
        while(r - l > 1)
        {
                m = floor((l + r) / 2);
-               if(lengthLogTable[m] < x)
+               if(lengthLogTable[m] < dist)
                        l = m;
                else
                        r = m;
        }
 
        // now: r is >=, l is <
-       float lerr = (x - lengthLogTable[l]);
-       float rerr = (lengthLogTable[r] - x);
+       float lerr = (dist - lengthLogTable[l]);
+       float rerr = (lengthLogTable[r] - dist);
        if(lerr < rerr)
                return l;
        return r;
@@ -263,26 +263,26 @@ vector decompressShortVector(int data)
        if(data == 0)
                return '0 0 0';
        float p = (data & 0xF000) / 0x1000;
-       float y = (data & 0x0F80) / 0x80;
+       float q = (data & 0x0F80) / 0x80;
        int len = (data & 0x007F);
 
-       //print("\ndecompress: p ", ftos(p)); print("y ", ftos(y)); print("len ", ftos(len), "\n");
+       //print("\ndecompress: p ", ftos(p)); print("q ", ftos(q)); print("len ", ftos(len), "\n");
 
        if(p == 0)
        {
                out.x = 0;
                out.y = 0;
-               if(y == 31)
+               if(q == 31)
                        out.z = -1;
                else
                        out.z = +1;
        }
        else
        {
-               y   = .19634954084936207740 * y;
+               q   = .19634954084936207740 * q;
                p = .19634954084936207740 * p - 1.57079632679489661922;
-               out.x = cos(y) *  cos(p);
-               out.y = sin(y) *  cos(p);
+               out.x = cos(q) *  cos(p);
+               out.y = sin(q) *  cos(p);
                out.z =          -sin(p);
        }
 
@@ -1073,26 +1073,25 @@ vector get_shotvelocity(vector myvel, vector mydir, float spd, float newton_styl
 
 float compressShotOrigin(vector v)
 {
-       float x, y, z;
-       x = rint(v.x * 2);
-       y = rint(v.y * 4) + 128;
-       z = rint(v.z * 4) + 128;
-       if(x > 255 || x < 0)
+       float rx = rint(v.x * 2);
+       float ry = rint(v.y * 4) + 128;
+       float rz = rint(v.z * 4) + 128;
+       if(rx > 255 || rx < 0)
        {
                LOG_INFO("shot origin ", vtos(v), " x out of bounds\n");
-               x = bound(0, x, 255);
+               rx = bound(0, rx, 255);
        }
-       if(y > 255 || y < 0)
+       if(ry > 255 || ry < 0)
        {
                LOG_INFO("shot origin ", vtos(v), " y out of bounds\n");
-               y = bound(0, y, 255);
+               ry = bound(0, ry, 255);
        }
-       if(z > 255 || z < 0)
+       if(rz > 255 || rz < 0)
        {
                LOG_INFO("shot origin ", vtos(v), " z out of bounds\n");
-               z = bound(0, z, 255);
+               rz = bound(0, rz, 255);
        }
-       return x * 0x10000 + y * 0x100 + z;
+       return rx * 0x10000 + ry * 0x100 + rz;
 }
 vector decompressShotOrigin(int f)
 {
index 57f9a2217c42d5a502e8268c139bd8f082094d29..05e4a4ea2736b4e5c8e92a9859e58ae870391c7b 100644 (file)
@@ -103,7 +103,7 @@ float almost_equals(float a, float b);
 float almost_in_bounds(float a, float b, float c);
 
 float power2of(float e);
-float log2of(float x);
+float log2of(float e);
 
 vector rgb_to_hsl(vector rgb);
 vector hsl_to_rgb(vector hsl);
@@ -238,7 +238,7 @@ void queue_to_execute_next_frame(string s);
 // f(1) = 1
 // f'(0) = startspeedfactor
 // f'(1) = endspeedfactor
-float cubic_speedfunc(float startspeedfactor, float endspeedfactor, float x);
+float cubic_speedfunc(float startspeedfactor, float endspeedfactor, float spd);
 
 // checks whether f'(x) = 0 anywhere from 0 to 1
 // because if this is the case, the function is not usable for platforms
index d4ed9505b987646aaff37d154fbae1e34ebf6f47..e9c5bf41d002167c5f3b74b17d99de8fad0ad60a 100644 (file)
@@ -2,6 +2,7 @@
 
 #include <common/weapons/_all.qh>
 
+#ifdef SVQC
 float autocvar_g_vehicle_bumblebee_cannon_cost = 2;
 float autocvar_g_vehicle_bumblebee_cannon_damage = 60;
 float autocvar_g_vehicle_bumblebee_cannon_radius = 225;
@@ -9,6 +10,7 @@ float autocvar_g_vehicle_bumblebee_cannon_refire = 0.2;
 float autocvar_g_vehicle_bumblebee_cannon_speed = 20000;
 float autocvar_g_vehicle_bumblebee_cannon_spread = 0.02;
 float autocvar_g_vehicle_bumblebee_cannon_force = -35;
+#endif
 
 #ifdef SVQC
 void bumblebee_fire_cannon(entity this, entity _gun, string _tagname, entity _owner);
index 41a31743f621d94fcd8c35db61f72d499feeeded..0cdfc8cb870b52960254e754c07f38c5c0dfaa0a 100644 (file)
@@ -35,7 +35,7 @@ float autocvar_g_vehicle_racer_friction = 0.45;
 
 float autocvar_g_vehicle_racer_water_time = 5;
 
-float autocvar_g_vehicle_racer_collision_multiplier = 0.05;
+//float autocvar_g_vehicle_racer_collision_multiplier = 0.05;
 
 // 0 = hover, != 0 = maglev
 int autocvar_g_vehicle_racer_hovertype = 0;
index 51c20ef9d0244a4dd994b5ed00e4570d224e0b77..f8b18a86ff03aec6a5c1d3efe8519d37c558ee80 100644 (file)
@@ -15,6 +15,7 @@ REGISTER_WEAPON(RACER, NEW(RacerAttack));
 void racer_fire_rocket(entity player, vector org, vector dir, entity trg);
 #endif
 
+#ifdef SVQC
 float autocvar_g_vehicle_racer_cannon_cost = 2;
 float autocvar_g_vehicle_racer_cannon_damage = 15;
 float autocvar_g_vehicle_racer_cannon_radius = 100;
@@ -33,3 +34,4 @@ float autocvar_g_vehicle_racer_rocket_refire = 3;
 
 float autocvar_g_vehicle_racer_rocket_climbspeed = 1600;
 float autocvar_g_vehicle_racer_rocket_locked_maxangle = 1.8;
+#endif
index 4260d4292ee47649ba2b8592756c2be0116e78aa..a7908d50d340829f44d903c59749aadd134e85f8 100644 (file)
@@ -26,7 +26,7 @@ CLASS(RaptorFlare, PortoLaunch)
 ENDCLASS(RaptorFlare)
 REGISTER_WEAPON(RAPTOR_FLARE, NEW(RaptorFlare));
 
-
+#ifdef SVQC
 float autocvar_g_vehicle_raptor_cannon_cost = 1;
 float autocvar_g_vehicle_raptor_cannon_damage = 10;
 float autocvar_g_vehicle_raptor_cannon_radius = 60;
@@ -51,3 +51,4 @@ float autocvar_g_vehicle_raptor_flare_refire = 5;
 float autocvar_g_vehicle_raptor_flare_lifetime = 10;
 float autocvar_g_vehicle_raptor_flare_chase = 0.9;
 float autocvar_g_vehicle_raptor_flare_range = 2000;
+#endif
index 347d2120aa1a17155db038821fbfcdc6f880c5f8..d99335a51c3bcdde3497a9f6cd2866fdfa87d4da 100644 (file)
@@ -603,8 +603,8 @@ METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
 
 #endif // SVQC
 #ifdef CSQC
-float autocvar_cl_vehicle_spiderbot_cross_alpha = 0.6;
-float autocvar_cl_vehicle_spiderbot_cross_size = 1;
+//float autocvar_cl_vehicle_spiderbot_cross_alpha = 0.6;
+//float autocvar_cl_vehicle_spiderbot_cross_size = 1;
 
 METHOD(Spiderbot, vr_hud, void(Spiderbot thisveh))
 {
index a1523045a6ca000ee6eab8119fead769288dc31f..199d9cfa47d8debf5d1d6b7d459af1b4cca7b9ad 100644 (file)
@@ -6,6 +6,7 @@
 void spiderbot_rocket_do(entity this);
 #endif
 
+#ifdef SVQC
 // 400 (x2) DPS
 float autocvar_g_vehicle_spiderbot_minigun_damage = 24;
 float autocvar_g_vehicle_spiderbot_minigun_refire = 0.06;
@@ -30,3 +31,4 @@ float autocvar_g_vehicle_spiderbot_rocket_health = 100;
 float autocvar_g_vehicle_spiderbot_rocket_noise = 0.2;
 float autocvar_g_vehicle_spiderbot_rocket_turnrate = 0.25;
 float autocvar_g_vehicle_spiderbot_rocket_lifetime = 20;
+#endif
index 9570e8c561aaac732a39ba63ae1a5d51fdbf68e9..a805ce5fd4210a014b938bcf41c7cf46df4ad034 100644 (file)
@@ -143,10 +143,12 @@ X(weaponreplace, string)
 X(weaponstartoverride, float)
 X(weaponstart, float)
 X(weaponthrowable, float)
+#ifdef SVQC
 X(reload_ammo, float)
 .float reloading_ammo = reload_ammo;
 X(reload_time, float)
 .float reloading_time = reload_time;
+#endif
 #undef X
 
 
index d16d733d5989a13ea7284ae0385da9f1c1d4d9f4..b287b148f3175727cebf8fa1e44a288099ae8e2b 100644 (file)
@@ -117,6 +117,8 @@ CLASS(Weapon, Object)
         // no weapon specific image for this weapon
         return false;
     }
+    /** (CLIENT) weapon specific view model */
+    METHOD(Weapon, wr_viewmodel, string(Weapon this, entity wep)) { return string_null; }
     /** (CLIENT) weapon specific glow */
     METHOD(Weapon, wr_glow, vector(Weapon this, entity actor)) { return '0 0 0'; }
     /** (SERVER) the weapon is dropped */
index 1f01ef0413c237e262752c59bd5daee816131968..e3e1f5228dc0d0839efeb1a4f9015f8d04f38ce1 100644 (file)
@@ -487,6 +487,15 @@ METHOD(Tuba, wr_killmessage, Notification(Tuba this))
                return WEAPON_TUBA_MURDER;
 }
 
+#elif defined(CSQC)
+
+METHOD(Tuba, wr_viewmodel, string(Tuba this, entity wep))
+{
+       return (wep.tuba_instrument == 0) ? "tuba" :
+              (wep.tuba_instrument == 1) ? "akordeon" :
+                                           "kleinbottle";
+}
+
 #endif
 
 #ifdef CSQC
index a617c73b09312ca5c1de45d2b8cac9ef47c2929e..2d48e577b8da2bf72b5ae3fa8cf19da46d8b89aa 100644 (file)
@@ -28,8 +28,8 @@
  */
 #define SYSTEM(sys, frameLimit, minfps) \
        void sys_##sys##_update(entity this, float dt); \
-       float autocvar_xon_sys_##sys##_dt = ((frameLimit) ? (1 / (frameLimit)) : 0); \
-       float autocvar_xon_sys_##sys##_minfps = (1 / (1 / (minfps)))
+       noref float autocvar_xon_sys_##sys##_dt = ((frameLimit) ? (1 / (frameLimit)) : 0); \
+       noref float autocvar_xon_sys_##sys##_minfps = (1 / (1 / (minfps)))
 
 #define SYSTEM_UPDATE(sys) \
        MACRO_BEGIN \
index b25c93b2d3d3177342e8994b12a29b26ecceb7dd..0c18e58cf8a577335f67526aae0412c52534ad73 100644 (file)
@@ -160,9 +160,6 @@ void sys_phys_update(entity this, float dt)
 /** for players */
 void sys_phys_simulate(entity this, float dt)
 {
-       const vector g = -this.com_phys_gravity;
-       const bool jump = this.com_in_jump;
-
        if (!this.com_phys_ground && !this.com_phys_air) {
                // noclipping
                // flying
@@ -172,6 +169,7 @@ void sys_phys_simulate(entity this, float dt)
                UNSET_ONGROUND(this);
 
                if (this.com_phys_friction_air) {
+                       const vector g = -this.com_phys_gravity;
                        this.velocity_z += g.z / 2;
                        this.velocity = this.velocity * (1 - dt * this.com_phys_friction);
                        this.velocity_z += g.z / 2;
@@ -181,7 +179,7 @@ void sys_phys_simulate(entity this, float dt)
        if (this.com_phys_water) {
                // water jump only in certain situations
                // this mimics quakeworld code
-               if (jump && this.waterlevel == WATERLEVEL_SWIMMING && this.velocity_z >= -180 && !this.viewloc) {
+               if (this.com_in_jump && this.waterlevel == WATERLEVEL_SWIMMING && this.velocity_z >= -180 && !this.viewloc) {
                        vector yawangles = '0 1 0' * this.v_angle.y;
                        makevectors(yawangles);
                        vector forward = v_forward;
@@ -320,7 +318,7 @@ void sys_phys_simulate(entity this, float dt)
                                }
 
                                // holding jump button swims upward slowly
-                               if (jump && !this.viewloc) {
+                               if (this.com_in_jump && !this.viewloc) {
                                        // was:
                                        // lava: 50
                                        // slime: 80
index 904ebba3fe5ccbea2b1f1aefaa55f502dd67450b..4973a182973a0f002b77691a8f93ba8133da09da 100644 (file)
@@ -37,7 +37,7 @@ void sys_phys_ai(entity this)
 void sys_phys_pregame_hold(entity this)
 {
        if (!IS_PLAYER(this)) { return; }
-       const bool allowed_to_move = (time >= game_starttime);
+       const bool allowed_to_move = (time >= game_starttime && !gameover);
        if (!allowed_to_move) {
                this.velocity = '0 0 0';
                set_movetype(this, MOVETYPE_NONE);
index 6408d6e3f2502aceebbe720c3151ccd8576dd9c2..65dc080c2ca7a103779918b04ad3cabb25718e81 100644 (file)
@@ -183,6 +183,12 @@ void make_safe_for_remove(entity this);
        void SetChangeParms() { ENGINE_EVENT(); if (_SetChangeParms) _SetChangeParms(this); }
        #define SetChangeParms _SetChangeParms
 
+#ifdef DP_EXT_PRECONNECT
+       void _ClientPreConnect(entity this);
+       void ClientPreConnect() { ENGINE_EVENT(); if (_ClientPreConnect) _ClientPreConnect(this); }
+       #define ClientPreConnect _ClientPreConnect
+#endif
+
        void _ClientConnect(entity this);
        void ClientConnect() { ENGINE_EVENT(); if (_ClientConnect) _ClientConnect(this); }
        #define ClientConnect _ClientConnect
index feb7a8247455bd84d7e426014bc301f787ac2c6e..92d45bf142573663919fcfe5b6f93f09dc2a8f16 100644 (file)
@@ -82,12 +82,12 @@ vector bezier_quadratic_getderivative(vector a, vector b, vector c, float t)
               + (b - a) * 2;
 }
 
-float cubic_speedfunc(float startspeedfactor, float endspeedfactor, float x)
+float cubic_speedfunc(float startspeedfactor, float endspeedfactor, float spd)
 {
        return (((startspeedfactor + endspeedfactor - 2
-                ) * x - 2 * startspeedfactor - endspeedfactor + 3
-               ) * x + startspeedfactor
-              ) * x;
+                ) * spd - 2 * startspeedfactor - endspeedfactor + 3
+               ) * spd + startspeedfactor
+              ) * spd;
 }
 
 bool cubic_speedfunc_is_sane(float startspeedfactor, float endspeedfactor)
@@ -195,54 +195,54 @@ float power2of(float e)
        return pow(2, e);
 }
 
-float log2of(float x)
+float log2of(float e)
 {
        // NOTE: generated code
-       if (x > 2048)
-               if (x > 131072)
-                       if (x > 1048576)
-                               if (x > 4194304) return 23;
+       if (e > 2048)
+               if (e > 131072)
+                       if (e > 1048576)
+                               if (e > 4194304) return 23;
                                else
-                                       if (x > 2097152) return 22;
+                                       if (e > 2097152) return 22;
                                        else return 21;
                        else
-                               if (x > 524288) return 20;
+                               if (e > 524288) return 20;
                                else
-                                       if (x > 262144) return 19;
+                                       if (e > 262144) return 19;
                                        else return 18;
                else
-                       if (x > 16384)
-                               if (x > 65536) return 17;
+                       if (e > 16384)
+                               if (e > 65536) return 17;
                                else
-                                       if (x > 32768) return 16;
+                                       if (e > 32768) return 16;
                                        else return 15;
                        else
-                               if (x > 8192) return 14;
+                               if (e > 8192) return 14;
                                else
-                                       if (x > 4096) return 13;
+                                       if (e > 4096) return 13;
                                        else return 12;
        else
-               if (x > 32)
-                       if (x > 256)
-                               if (x > 1024) return 11;
+               if (e > 32)
+                       if (e > 256)
+                               if (e > 1024) return 11;
                                else
-                                       if (x > 512) return 10;
+                                       if (e > 512) return 10;
                                        else return 9;
                        else
-                               if (x > 128) return 8;
+                               if (e > 128) return 8;
                                else
-                                       if (x > 64) return 7;
+                                       if (e > 64) return 7;
                                        else return 6;
                else
-                       if (x > 4)
-                               if (x > 16) return 5;
+                       if (e > 4)
+                               if (e > 16) return 5;
                                else
-                                       if (x > 8) return 4;
+                                       if (e > 8) return 4;
                                        else return 3;
                        else
-                               if (x > 2) return 2;
+                               if (e > 2) return 2;
                                else
-                                       if (x > 1) return 1;
+                                       if (e > 1) return 1;
                                        else return 0;
 }
 
index 43bd12314e53f246c25193e81a277dc53580f533..f4c246f33058997803e1291f243286cfce99362d 100644 (file)
@@ -48,7 +48,7 @@
 
 #define SELFWRAP(T, R, oldargs, args, forward) \
     .R oldargs T; \
-    .R oldargs __##T = T; \
+    noref .R oldargs __##T = T; \
     .R args self##T; \
     R T##_self oldargs { ENGINE_EVENT(); return this.self##T forward; }
 
index 4e3bc062d1bc78936bc7bb095b6e882f2a5cd380..e8aeaecae61f968bedd1f5ac640d7dce2e677b05 100644 (file)
@@ -29,7 +29,7 @@ noref bool require_spawnfunc_prefix;
 
        noref bool __spawnfunc_expecting;
        noref entity __spawnfunc_expect;
-       bool __spawnfunc_unreachable_workaround = true;
+       noref bool __spawnfunc_unreachable_workaround = true;
 
        #define spawnfunc_1(id) spawnfunc_2(id, FIELDS_UNION)
        #define spawnfunc_2(id, whitelist) \
index ac3b65ff1a276a3dd35c36f1c12d206055fd9fb0..e190518275b9c407570efae466fbdcb7ef758898 100644 (file)
 #elif defined(SVQC)
 #endif
 
-int fpclassify(float x)
+int fpclassify(float e)
 {
-       if(isnan(x))
+       if(isnan(e))
                return FP_NAN;
-       if(isinf(x))
+       if(isinf(e))
                return FP_INFINITE;
-       if(x == 0)
+       if(e == 0)
                return FP_ZERO;
        return FP_NORMAL;
 }
-bool isfinite(float x)
+bool isfinite(float e)
 {
-       return !(isnan(x) || isinf(x));
+       return !(isnan(e) || isinf(e));
 }
-bool isinf(float x)
+bool isinf(float e)
 {
-       return (x != 0) && (x + x == x);
+       return (e != 0) && (e + e == e);
 }
-bool isnan(float x)
+bool isnan(float e)
 {
-       float y;
-       y = x;
-       return (x != y);
+       float f = e;
+       return (e != f);
 }
-bool isnormal(float x)
+bool isnormal(float e)
 {
-       return isfinite(x);
+       return isfinite(e);
 }
-bool signbit(float x)
+bool signbit(float e)
 {
-       return (x < 0);
+       return (e < 0);
 }
 
-float acosh(float x)
+float acosh(float e)
 {
-       return log(x + sqrt(x*x - 1));
+       return log(e + sqrt(e*e - 1));
 }
-float asinh(float x)
+float asinh(float e)
 {
-       return log(x + sqrt(x*x + 1));
+       return log(e + sqrt(e*e + 1));
 }
-float atanh(float x)
+float atanh(float e)
 {
-       return 0.5 * log((1+x) / (1-x));
+       return 0.5 * log((1+e) / (1-e));
 }
-float cosh(float x)
+float cosh(float e)
 {
-       return 0.5 * (exp(x) + exp(-x));
+       return 0.5 * (exp(e) + exp(-e));
 }
-float sinh(float x)
+float sinh(float e)
 {
-       return 0.5 * (exp(x) - exp(-x));
+       return 0.5 * (exp(e) - exp(-e));
 }
-float tanh(float x)
+float tanh(float e)
 {
-       return sinh(x) / cosh(x);
+       return sinh(e) / cosh(e);
 }
 
-float exp(float x)
+float exp(float e)
 {
-       return pow(M_E, x);
+       return pow(M_E, e);
 }
-float exp2(float x)
+float exp2(float e)
 {
-       return pow(2, x);
+       return pow(2, e);
 }
-float expm1(float x)
+float expm1(float e)
 {
-       return exp(x) - 1;
+       return exp(e) - 1;
 }
 
-vector frexp(float x)
+vector frexp(float e)
 {
        vector v;
        v.z = 0;
-       v.y = ilogb(x) + 1;
-       v.x = x / exp2(v.y);
+       v.y = ilogb(e) + 1;
+       v.x = e / exp2(v.y);
        return v;
 }
-int ilogb(float x)
+int ilogb(float e)
 {
-       return floor(log2(fabs(x)));
+       return floor(log2(fabs(e)));
 }
-float ldexp(float x, int e)
+float ldexp(float e, int e)
 {
-       return x * pow(2, e);
+       return e * pow(2, e);
 }
-float logn(float x, float base)
+float logn(float e, float base)
 {
-       return log(x) / log(base);
+       return log(e) / log(base);
 }
-float log10(float x)
+float log10(float e)
 {
-       return log(x) * M_LOG10E;
+       return log(e) * M_LOG10E;
 }
-float log1p(float x)
+float log1p(float e)
 {
-       return log(x + 1);
+       return log(e + 1);
 }
-float log2(float x)
+float log2(float e)
 {
-       return log(x) * M_LOG2E;
+       return log(e) * M_LOG2E;
 }
-float logb(float x)
+float logb(float e)
 {
-       return floor(log2(fabs(x)));
+       return floor(log2(fabs(e)));
 }
 vector modf(float f)
 {
        return '1 0 0' * (f - trunc(f)) + '0 1 0' * trunc(f);
 }
 
-float scalbn(float x, int n)
+float scalbn(float e, int n)
 {
-       return x * pow(2, n);
+       return e * pow(2, n);
 }
 
-float cbrt(float x)
+float cbrt(float e)
 {
-       return copysign(pow(fabs(x), 1.0/3.0), x);
+       return copysign(pow(fabs(e), 1.0/3.0), e);
 }
-float hypot(float x, float y)
+float hypot(float e, float f)
 {
-       return sqrt(x*x + y*y);
+       return sqrt(e*e + f*f);
 }
 
-float erf(float x)
+float erf(float e)
 {
        // approximation taken from wikipedia
-       float y;
-       y = x*x;
-       return copysign(sqrt(1 - exp(-y * (1.273239544735163 + 0.14001228868667 * y) / (1 + 0.14001228868667 * y))), x);
+       float f;
+       f = e*e;
+       return copysign(sqrt(1 - exp(-f * (1.273239544735163 + 0.14001228868667 * f) / (1 + 0.14001228868667 * f))), e);
 }
-float erfc(float x)
+float erfc(float e)
 {
-       return 1.0 - erf(x);
+       return 1.0 - erf(e);
 }
-vector lgamma(float x)
+vector lgamma(float e)
 {
        // TODO improve accuracy
-       if(!isfinite(x))
-               return fabs(x) * '1 0 0' + copysign(1, x) * '0 1 0';
-       if(x < 1 && x == floor(x))
+       if(!isfinite(e))
+               return fabs(e) * '1 0 0' + copysign(1, e) * '0 1 0';
+       if(e < 1 && e == floor(e))
                return nan("gamma") * '1 1 1';
-       if(x < 0.1)
+       if(e < 0.1)
        {
                vector v;
-               v = lgamma(1.0 - x);
+               v = lgamma(1.0 - e);
                // reflection formula:
                // gamma(1-z) * gamma(z) = pi / sin(pi*z)
                // lgamma(1-z) + lgamma(z) = log(pi) - log(sin(pi*z))
                // sign of gamma(1-z) = sign of gamma(z) * sign of sin(pi*z)
-               v.z = sin(M_PI * x);
+               v.z = sin(M_PI * e);
                v.x = log(M_PI) - log(fabs(v.z)) - v.x;
                if(v.z < 0)
                        v.y = -v.y;
                v.z = 0;
                return v;
        }
-       if(x < 1.1)
-               return lgamma(x + 1) - log(x) * '1 0 0';
-       x -= 1;
-       return (0.5 * log(2 * M_PI * x) + x * (log(x) - 1)) * '1 0 0' + '0 1 0';
+       if(e < 1.1)
+               return lgamma(e + 1) - log(e) * '1 0 0';
+       e -= 1;
+       return (0.5 * log(2 * M_PI * e) + e * (log(e) - 1)) * '1 0 0' + '0 1 0';
 }
-float tgamma(float x)
+float tgamma(float e)
 {
-       vector v;
-       v = lgamma(x);
+       vector v = lgamma(e);
        return exp(v.x) * v.y;
 }
 
@@ -184,109 +182,109 @@ float tgamma(float x)
  *  1 % -2 == -1
  * -1 % -2 == -1
  */
-float pymod(float x, float y)
+float pymod(float e, float f)
 {
-       return x - y * floor(x / y);
+       return e - f * floor(e / f);
 }
 
-float nearbyint(float x)
+float nearbyint(float e)
 {
-       return rint(x);
+       return rint(e);
 }
-float trunc(float x)
+float trunc(float e)
 {
-       return (x>=0) ? floor(x) : ceil(x);
+       return (e>=0) ? floor(e) : ceil(e);
 }
 
-float fmod(float x, float y)
+float fmod(float e, float f)
 {
-       return x - y * trunc(x / y);
+       return e - f * trunc(e / f);
 }
-float remainder(float x, float y)
+float remainder(float e, float f)
 {
-       return x - y * rint(x / y);
+       return e - f * rint(e / f);
 }
-vector remquo(float x, float y)
+vector remquo(float e, float f)
 {
        vector v;
        v.z = 0;
-       v.y = rint(x / y);
-       v.x = x - y * v.y;
+       v.y = rint(e / f);
+       v.x = e - f * v.y;
        return v;
 }
 
-float copysign(float x, float y)
+float copysign(float e, float f)
 {
-       return fabs(x) * ((y>0) ? 1 : -1);
+       return fabs(e) * ((f>0) ? 1 : -1);
 }
 float nan(string tag)
 {
        return sqrt(-1);
 }
-float nextafter(float x, float y)
+float nextafter(float e, float f)
 {
        // TODO very crude
-       if(x == y)
+       if(e == f)
                return nan("nextafter");
-       if(x > y)
-               return -nextafter(-x, -y);
-       // now we know that x < y
-       // so we need the next number > x
+       if(e > f)
+               return -nextafter(-e, -f);
+       // now we know that e < f
+       // so we need the next number > e
        float d, a, b;
-       d = max(fabs(x), 0.00000000000000000000001);
-       a = x + d;
+       d = max(fabs(e), 0.00000000000000000000001);
+       a = e + d;
        do
        {
                d *= 0.5;
                b = a;
-               a = x + d;
+               a = e + d;
        }
-       while(a != x);
+       while(a != e);
        return b;
 }
-float nexttoward(float x, float y)
+float nexttoward(float e, float f)
 {
-       return nextafter(x, y);
+       return nextafter(e, f);
 }
 
-float fdim(float x, float y)
+float fdim(float e, float f)
 {
-       return max(x-y, 0);
+       return max(e-f, 0);
 }
-float fmax(float x, float y)
+float fmax(float e, float f)
 {
-       return max(x, y);
+       return max(e, f);
 }
-float fmin(float x, float y)
+float fmin(float e, float f)
 {
-       return min(x, y);
+       return min(e, f);
 }
-float fma(float x, float y, float z)
+float fma(float e, float f, float g)
 {
-       return x * y + z;
+       return e * f + g;
 }
 
-int isgreater(float x, float y)
+int isgreater(float e, float f)
 {
-       return x > y;
+       return e > f;
 }
-int isgreaterequal(float x, float y)
+int isgreaterequal(float e, float f)
 {
-       return x >= y;
+       return e >= f;
 }
-int isless(float x, float y)
+int isless(float e, float f)
 {
-       return x < y;
+       return e < f;
 }
-int islessequal(float x, float y)
+int islessequal(float e, float f)
 {
-       return x <= y;
+       return e <= f;
 }
-int islessgreater(float x, float y)
+int islessgreater(float e, float f)
 {
-       return x < y || x > y;
+       return e < f || e > f;
 }
-int isunordered(float x, float y)
+int isunordered(float e, float f)
 {
-       return !(x < y || x == y || x > y);
+       return !(e < f || e == f || e > f);
 }
index 2b35c92f8457e6fbb00ba0f05610598ea10faa5e..f5d8f63e74a1eba84c3a1008675e7fa0e4be3f91 100644 (file)
@@ -10,55 +10,55 @@ const int FP_INFINITE = 1;
 const int FP_ZERO = 2;
 const int FP_SUBNORMAL = 3;
 const int FP_NORMAL = 4;
-int fpclassify(float x);
-bool isfinite(float x);
-bool isinf(float x);
-bool isnan(float x);
-bool isnormal(float x);
-bool signbit(float x);
-
-//float acos(float x);
-//float asin(float x);
-//float atan(float x);
-//float atan2(float y, float x);
-//float cos(float x);
-//float sin(float x);
-//float tan(float x);
-
-float acosh(float x);
-float asinh(float x);
-float atanh(float x);
-float cosh(float x);
-float sinh(float x);
-float tanh(float x);
-
-float exp(float x);
-float exp2(float x);
-float expm1(float x);
-
-vector frexp(float x); // returns mantissa as _x, exponent as _y
-int ilogb(float x);
-float ldexp(float x, int e);
-//float log(float x);
-float logn(float x, float base);
-float log10(float x);
-float log1p(float x);
-float log2(float x);
-float logb(float x);
+int fpclassify(float e);
+bool isfinite(float e);
+bool isinf(float e);
+bool isnan(float e);
+bool isnormal(float e);
+bool signbit(float e);
+
+//float acos(float e);
+//float asin(float e);
+//float atan(float e);
+//float atan2(float f, float e);
+//float cos(float e);
+//float sin(float e);
+//float tan(float e);
+
+float acosh(float e);
+float asinh(float e);
+float atanh(float e);
+float cosh(float e);
+float sinh(float e);
+float tanh(float e);
+
+float exp(float e);
+float exp2(float e);
+float expm1(float e);
+
+vector frexp(float e); // returns mantissa as _x, exponent as _y
+int ilogb(float e);
+float ldexp(float e, int e);
+//float log(float e);
+float logn(float e, float base);
+float log10(float e);
+float log1p(float e);
+float log2(float e);
+float logb(float e);
 vector modf(float f); // fraction as _x, integer as _y
 
-float scalbn(float x, int n);
+float scalbn(float e, int n);
 
-float cbrt(float x);
-//float fabs(float x);
-float hypot(float x, float y);
-//float pow(float x, float y);
-//float sqrt(float x, float y);
+float cbrt(float e);
+//float fabs(float e);
+float hypot(float e, float f);
+//float pow(float e, float f);
+//float sqrt(float e, float f);
 
-float erf(float x);
-float erfc(float x);
-vector lgamma(float x); // value in _x, sign in _y
-float tgamma(float x);
+float erf(float e);
+float erfc(float e);
+vector lgamma(float e); // value in _x, sign in _y
+float tgamma(float e);
 
 /**
  * Pythonic mod:
@@ -69,35 +69,35 @@ float tgamma(float x);
  *  1 % -2 == -1
  * -1 % -2 == -1
  */
-float pymod(float x, float y);
+float pymod(float e, float f);
 
-//float ceil(float x);
-//float floor(float x);
-float nearbyint(float x);
-//float rint(float x);
-//float round(float x);
-float trunc(float x);
+//float ceil(float e);
+//float floor(float e);
+float nearbyint(float e);
+//float rint(float e);
+//float round(float e);
+float trunc(float e);
 
-float fmod(float x, float y);
-float remainder(float x, float y);
-vector remquo(float x, float y);
+float fmod(float e, float f);
+float remainder(float e, float f);
+vector remquo(float e, float f);
 
-float copysign(float x, float y);
+float copysign(float e, float f);
 float nan(string tag);
-float nextafter(float x, float y);
-float nexttoward(float x, float y);
-
-float fdim(float x, float y);
-float fmax(float x, float y);
-float fmin(float x, float y);
-float fma(float x, float y, float z);
-
-int isgreater(float x, float y);
-int isgreaterequal(float x, float y);
-int isless(float x, float y);
-int islessequal(float x, float y);
-int islessgreater(float x, float y);
-int isunordered(float x, float y);
+float nextafter(float e, float f);
+float nexttoward(float e, float f);
+
+float fdim(float e, float f);
+float fmax(float e, float f);
+float fmin(float e, float f);
+float fma(float e, float f, float g);
+
+int isgreater(float e, float f);
+int isgreaterequal(float e, float f);
+int isless(float e, float f);
+int islessequal(float e, float f);
+int islessgreater(float e, float f);
+int isunordered(float e, float f);
 
 const float M_E        = 2.7182818284590452354;   /* e */
 const float M_LOG2E    = 1.4426950408889634074;   /* log_2 e */
index 06ac91f025fcb53c80804f4dcb2f4ac0f56e2838..59405ec169f15448df4e7f028c67b8e43ef56c0b 100644 (file)
                }
                return 1;
        }
-       void Image_setZoom(entity me, float z, float atMousePosition)
+       void Image_setZoom(entity me, float newzoom, float atMousePosition)
        {
                float prev_zoomFactor;
                prev_zoomFactor = me.zoomFactor;
-               if (z < 0)  // multiply by the current zoomFactor (but can also snap to real dimensions or to box)
+               if (newzoom < 0)  // multiply by the current zoomFactor (but can also snap to real dimensions or to box)
                {
-                       me.zoomFactor *= -z;
+                       me.zoomFactor *= -newzoom;
                        float realSize_in_the_middle, boxSize_in_the_middle;
                        realSize_in_the_middle = ((prev_zoomFactor - 1) * (me.zoomFactor - 1) < 0);
                        boxSize_in_the_middle = (me.zoomBox > 0 && (prev_zoomFactor - me.zoomBox) * (me.zoomFactor - me.zoomBox) < 0);
                                me.zoomFactor = me.zoomBox; // snap to box
                        }
                }
-               else if (z == 0)                    // reset (no zoom)
+               else if (newzoom == 0)                    // reset (no zoom)
                {
                        if (me.zoomBox > 0) me.zoomFactor = me.zoomBox;
                        else me.zoomFactor = 1;
                }
                else  // directly set
                {
-                       me.zoomFactor = z;
+                       me.zoomFactor = newzoom;
                }
                me.zoomFactor = bound(1 / 16, me.zoomFactor, 16);
                if (me.zoomMax > 0 && me.zoomFactor > me.zoomMax) me.zoomFactor = me.zoomMax;
index d9d63ab8c5abe2a6958b8c463fecdd985313ff4d..aa10c20b3b0f6d04bac8d5810e8b53b74bb799f2 100644 (file)
                oldshift = draw_shift;
                oldscale = draw_scale;
 
-               float y;
                i = me.getItemAtPos(me, me.scrollPos);
-               y = me.getItemStart(me, i) - me.scrollPos;
-               for ( ; i < me.nItems && y < 1; ++i)
+               float j = me.getItemStart(me, i) - me.scrollPos;
+               for ( ; i < me.nItems && j < 1; ++i)
                {
-                       draw_shift = boxToGlobal(eY * y, oldshift, oldscale);
+                       draw_shift = boxToGlobal(eY * j, oldshift, oldscale);
                        vector relSize = eX * (1 - me.controlWidth) + eY * me.getItemHeight(me, i);
                        absSize = boxToGlobalSize(relSize, me.size);
                        draw_scale = boxToGlobalSize(relSize, oldscale);
                        me.drawListBoxItem(me, i, absSize, (me.selectedItem == i), (me.focusedItem == i));
-                       y += relSize.y;
+                       j += relSize.y;
                }
                draw_ClearClip();
 
index b863518981b7b9fb5023e881fc695754e7d7cfcb..949b01c41da50c353beb177a70991d4683f28741 100644 (file)
@@ -2,28 +2,28 @@
 
 entity makeXonoticCheckBox_T(float isInverted, string theCvar, string theText, string theTooltip)
 {
-       float y, n;
+       float m, n;
        if(isInverted > 1)
        {
                n = isInverted - 1;
-               y = -n;
+               m = -n;
        }
        else if(isInverted < -1)
        {
                n = isInverted + 1;
-               y = -n;
+               m = -n;
        }
        else if(isInverted == 1)
        {
                n = 1;
-               y = 0;
+               m = 0;
        }
        else
        {
                n = 0;
-               y = 1;
+               m = 1;
        }
-       return makeXonoticCheckBoxEx_T(y, n, theCvar, theText, theTooltip);
+       return makeXonoticCheckBoxEx_T(m, n, theCvar, theText, theTooltip);
 }
 entity makeXonoticCheckBox(float isInverted, string theCvar, string theText)
 {
index 07fe09c100e0bd4a09498dec63b9a6f1bdbdea38..65edcdec9b48759ec8f7f6f166f23233d18d75d1 100644 (file)
@@ -53,8 +53,6 @@ string WeaponArenaString()
        return weaponarenastring;
 }
 
-AUTOCVAR(g_grappling_hook, bool, _("let players spawn with the grappling hook which allows them to pull themselves up"));
-
 string XonoticMutatorsDialog_toString(entity me)
 {
        string s;
@@ -79,7 +77,7 @@ string XonoticMutatorsDialog_toString(entity me)
                s = strcat(s, ", ", _("Low gravity"));
        if(cvar("g_cloaked"))
                s = strcat(s, ", ", _("Cloaked"));
-       if(autocvar_g_grappling_hook)
+       if(cvar("g_grappling_hook"))
                s = strcat(s, ", ", _("Hook"));
        if(cvar("g_midair"))
                s = strcat(s, ", ", _("Midair"));
index 82ff4ba7b2b8dad148e2b4f20cf854271ce95838..42e168b4b58b2617d5978b7bce289bd8ac4a8131 100644 (file)
@@ -56,12 +56,11 @@ void XonoticScreenshotImage_draw(entity me)
                if (time < me.zoomTime + 2) // 1 seconds at full alpha, 1 second fading out
                {
                        string zoomString;
-                       float z;
-                       z = me.zoomFactor * 100;
-                       if (z - floor(z) == 0)
-                               zoomString = sprintf("%d%%", z);
+                       float myzoom = me.zoomFactor * 100;
+                       if (myzoom - floor(myzoom) == 0)
+                               zoomString = sprintf("%d%%", myzoom);
                        else
-                               zoomString = sprintf("%.2f%%", z);
+                               zoomString = sprintf("%.2f%%", myzoom);
                        theAlpha = (2 - (time - me.zoomTime));
                        draw_Text('0.05 0.95 0', zoomString, me.realFontSize, '1 1 1', theAlpha, false);
                }
index cd3d702ab7ae976b40df3ca60382c70f01068158..bbb9dcac05488c54a2df6722a4ea591a477349e5 100644 (file)
@@ -471,9 +471,8 @@ void XonoticServerList_draw(entity me)
                // entire list, otherwise there is no way to know which item is first in its category.
 
                // binary search method suggested by div
-               float x;
                float begin = 0;
-               for(x = 1; x <= category_ent_count; ++x) {
+               for(int j = 1; j <= category_ent_count; ++j) {
                        float first = begin;
                        float last = (itemcount - 1);
                        if (first > last) {
@@ -482,42 +481,42 @@ void XonoticServerList_draw(entity me)
                        }
                        float catf = gethostcachenumber(SLIST_FIELD_CATEGORY, first);
                        float catl = gethostcachenumber(SLIST_FIELD_CATEGORY, last);
-                       if (catf > x) {
-                               // The first one is already > x.
-                               // Therefore, category x does not exist.
+                       if (catf > j) {
+                               // The first one is already > j.
+                               // Therefore, category j does not exist.
                                // Higher numbered categories do exist though.
-                       } else if (catl < x) {
-                               // The last one is < x.
+                       } else if (catl < j) {
+                               // The last one is < j.
                                // Thus this category - and any following -
                                // don't exist.
                                break;
-                       } else if (catf == x) {
+                       } else if (catf == j) {
                                // Starts at first. This breaks the loop
                                // invariant in the binary search and thus has
                                // to be handled separately.
-                               if(gethostcachenumber(SLIST_FIELD_CATEGORY, first) != x)
+                               if(gethostcachenumber(SLIST_FIELD_CATEGORY, first) != j)
                                        error("Category mismatch I");
                                if(first > 0)
-                                       if(gethostcachenumber(SLIST_FIELD_CATEGORY, first - 1) == x)
+                                       if(gethostcachenumber(SLIST_FIELD_CATEGORY, first - 1) == j)
                                                error("Category mismatch II");
-                               category_name[category_draw_count] = x;
+                               category_name[category_draw_count] = j;
                                category_item[category_draw_count] = first;
                                ++category_draw_count;
                                begin = first + 1;
                        } else {
-                               // At this point, catf <= x < catl, thus
+                               // At this point, catf <= j < catl, thus
                                // catf < catl, thus first < last.
                                // INVARIANTS:
                                // last - first >= 1
                                // catf == gethostcachenumber(SLIST_FIELD_CATEGORY(first)
                                // catl == gethostcachenumber(SLIST_FIELD_CATEGORY(last)
-                               // catf < x
-                               // catl >= x
+                               // catf < j
+                               // catl >= j
                                while (last - first > 1) {
                                        float middle = floor((first + last) / 2);
                                        // By loop condition, middle != first && middle != last.
                                        float cat = gethostcachenumber(SLIST_FIELD_CATEGORY, middle);
-                                       if (cat >= x) {
+                                       if (cat >= j) {
                                                last = middle;
                                                catl = cat;
                                        } else {
@@ -525,13 +524,13 @@ void XonoticServerList_draw(entity me)
                                                catf = cat;
                                        }
                                }
-                               if (catl == x) {
-                                       if(gethostcachenumber(SLIST_FIELD_CATEGORY, last) != x)
+                               if (catl == j) {
+                                       if(gethostcachenumber(SLIST_FIELD_CATEGORY, last) != j)
                                                error("Category mismatch III");
                                        if(last > 0)
-                                               if(gethostcachenumber(SLIST_FIELD_CATEGORY, last - 1) == x)
+                                               if(gethostcachenumber(SLIST_FIELD_CATEGORY, last - 1) == j)
                                                        error("Category mismatch IV");
-                                       category_name[category_draw_count] = x;
+                                       category_name[category_draw_count] = j;
                                        category_item[category_draw_count] = last;
                                        ++category_draw_count;
                                        begin = last + 1; // already scanned through these, skip 'em
index 2b78141383d28579d157c5d583addf039427f90d..dcc2c85b06a1746bec59d3144dd7222e08cae1a9 100644 (file)
@@ -7,9 +7,9 @@ float toDecibelOfSquare(float f, float mi)
        {
                // linear scale part
                float t = 1 / A + mi;
-               float y = exp(1 + A * mi);
-               if(f <= y)
-                       return mi + (t - mi) * (f / y);
+               float u = exp(1 + A * mi);
+               if(f <= u)
+                       return mi + (t - mi) * (f / u);
        }
        return log(f) / A;
 }
@@ -21,9 +21,9 @@ float fromDecibelOfSquare(float f, float mi)
        {
                // linear scale part
                float t = 1 / A + mi;
-               float y = exp(1 + A * mi);
+               float u = exp(1 + A * mi);
                if(f <= t)
-                       return y * ((f - mi) / (t - mi));
+                       return u * ((f - mi) / (t - mi));
        }
        return exp(A * f);
 }
index 4861fe2a79c25cb75ca100e3ddc6b1545870d863..4e794cb3fc361e7796c98fb66d80b2daae4f4525 100644 (file)
@@ -6,6 +6,7 @@
 #include "miscfunctions.qh"
 
 #include "command/common.qh"
+#include <common/playerstats.qh>
 #include <common/state.qh>
 
 .float anticheat_jointime;
@@ -158,67 +159,66 @@ void anticheat_prethink(entity this)
        CS(this).anticheat_div0_evade_offset = 0;
 }
 
-string anticheat_display(float f, float tmin, float mi, float ma)
+string anticheat_display(float f, float t, float tmin, float mi, float ma)
 {
        string s;
        s = ftos(f);
-       if(f <= mi)
-               return strcat(s, ":N");
-       if(f >= ma)
-               return strcat(s, ":Y");
+       if (t >= tmin) {
+               if(f <= mi)
+                       return strcat(s, ":N");
+               if(f >= ma)
+                       return strcat(s, ":Y");
+       }
        return strcat(s, ":-");
 }
 
-void anticheat_report(entity this)
-{
+#define ANTICHEATS(ANTICHEAT) \
+       ANTICHEAT("speedhack", MEAN_EVALUATE(CS(this), anticheat_speedhack), 240, 0, 9999); /* Actually this one seems broken. */ \
+       ANTICHEAT("speedhack_m1", MEAN_EVALUATE(CS(this), anticheat_speedhack_m1), 240, 1.01, 1.25); \
+       ANTICHEAT("speedhack_m2", MEAN_EVALUATE(CS(this), anticheat_speedhack_m2), 240, 1.01, 1.25); \
+       ANTICHEAT("speedhack_m3", MEAN_EVALUATE(CS(this), anticheat_speedhack_m3), 240, 1.01, 1.25); \
+       ANTICHEAT("speedhack_m4", MEAN_EVALUATE(CS(this), anticheat_speedhack_m4), 240, 1.01, 1.25); \
+       ANTICHEAT("speedhack_m5", MEAN_EVALUATE(CS(this), anticheat_speedhack_m5), 240, 1.01, 1.25); \
+       ANTICHEAT("div0_strafebot_old", MEAN_EVALUATE(CS(this), anticheat_div0_strafebot_old), 120, 0.15, 0.4); \
+       ANTICHEAT("div0_strafebot_new", MEAN_EVALUATE(CS(this), anticheat_div0_strafebot_new), 120, 0.25, 0.8); \
+       ANTICHEAT("div0_evade", MEAN_EVALUATE(CS(this), anticheat_div0_evade), 120, 0.2, 0.5); \
+       ANTICHEAT("idle_snapaim", MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_signal) - MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_noise), 120, 0, 9999); \
+       ANTICHEAT("idle_snapaim_signal", MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_signal), 120, 0, 9999); \
+       ANTICHEAT("idle_snapaim_noise", MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_noise), 120, 0, 9999); \
+       ANTICHEAT("idle_snapaim_m2", MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m2), 120, 0, 9999); \
+       ANTICHEAT("idle_snapaim_m3", MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m3), 120, 0, 9999); \
+       ANTICHEAT("idle_snapaim_m4", MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m4), 120, 0, 9999); \
+       ANTICHEAT("idle_snapaim_m7", MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m7), 120, 0, 9999); \
+       ANTICHEAT("idle_snapaim_m10", MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m10), 120, 0, 9999)
+
+void anticheat_report_to_eventlog(entity this) {
        if(!autocvar_sv_eventlog)
                return;
-       // TODO(divVerent): Use xonstat to acquire good thresholds.
        GameLogEcho(strcat(":anticheat:_time:", ftos(this.playerid), ":", ftos(servertime - CS(this).anticheat_jointime)));
-       GameLogEcho(strcat(":anticheat:speedhack:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_speedhack), 240, 0, 9999))); // Actually this one seems broken.
-       GameLogEcho(strcat(":anticheat:speedhack_m1:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_speedhack_m1), 240, 1.01, 1.25)));
-       GameLogEcho(strcat(":anticheat:speedhack_m2:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_speedhack_m2), 240, 1.01, 1.25)));
-       GameLogEcho(strcat(":anticheat:speedhack_m3:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_speedhack_m3), 240, 1.01, 1.25)));
-       GameLogEcho(strcat(":anticheat:speedhack_m4:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_speedhack_m4), 240, 1.01, 1.25)));
-       GameLogEcho(strcat(":anticheat:speedhack_m5:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_speedhack_m5), 240, 1.01, 1.25)));
-       GameLogEcho(strcat(":anticheat:div0_strafebot_old:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_div0_strafebot_old), 120, 0.15, 0.4)));
-       GameLogEcho(strcat(":anticheat:div0_strafebot_new:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_div0_strafebot_new), 120, 0.25, 0.8)));
-       GameLogEcho(strcat(":anticheat:div0_evade:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_div0_evade), 120, 0.2, 0.5)));
-       GameLogEcho(strcat(":anticheat:idle_snapaim:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_signal) - MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_noise), 120, 0, 9999)));
-       GameLogEcho(strcat(":anticheat:idle_snapaim_signal:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_signal), 120, 0, 9999)));
-       GameLogEcho(strcat(":anticheat:idle_snapaim_noise:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_noise), 120, 0, 9999)));
-       GameLogEcho(strcat(":anticheat:idle_snapaim_m2:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m2), 120, 0, 9999)));
-       GameLogEcho(strcat(":anticheat:idle_snapaim_m3:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m3), 120, 0, 9999)));
-       GameLogEcho(strcat(":anticheat:idle_snapaim_m4:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m4), 120, 0, 9999)));
-       GameLogEcho(strcat(":anticheat:idle_snapaim_m7:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m7), 120, 0, 9999)));
-       GameLogEcho(strcat(":anticheat:idle_snapaim_m10:", ftos(this.playerid), ":", anticheat_display(MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m10), 120, 0, 9999)));
+#define ANTICHEAT_REPORT_ONE(name, f, tmin, mi, ma) \
+       GameLogEcho(strcat(":anticheat:", name, ":", anticheat_display(f, servertime - CS(this).anticheat_jointime, tmin, mi, ma)))
+       ANTICHEATS(ANTICHEAT_REPORT_ONE);
+#undef ANTICHEAT_REPORT_ONE
 }
 
-float anticheat_getvalue(entity this, string id)
-{
-       switch(id) {
-               case "_time": return servertime - CS(this).anticheat_jointime;
-               case "speedhack": return MEAN_EVALUATE(CS(this), anticheat_speedhack);
-               case "speedhack_m1": return MEAN_EVALUATE(CS(this), anticheat_speedhack_m1);
-               case "speedhack_m2": return MEAN_EVALUATE(CS(this), anticheat_speedhack_m2);
-               case "speedhack_m3": return MEAN_EVALUATE(CS(this), anticheat_speedhack_m3);
-               case "speedhack_m4": return MEAN_EVALUATE(CS(this), anticheat_speedhack_m4);
-               case "speedhack_m5": return MEAN_EVALUATE(CS(this), anticheat_speedhack_m5);
-               case "div0_strafebot_old": return MEAN_EVALUATE(CS(this), anticheat_div0_strafebot_old);
-               case "div0_strafebot_new": return MEAN_EVALUATE(CS(this), anticheat_div0_strafebot_new);
-               case "div0_evade": return MEAN_EVALUATE(CS(this), anticheat_div0_evade);
-               case "idle_snapaim": return MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_signal) - MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_noise);
-               case "idle_snapaim_signal": return MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_signal);
-               case "idle_snapaim_noise": return MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_noise);
-               case "idle_snapaim_m2": return MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m2);
-               case "idle_snapaim_m3": return MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m3);
-               case "idle_snapaim_m4": return MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m4);
-               case "idle_snapaim_m7": return MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m7);
-               case "idle_snapaim_m10": return MEAN_EVALUATE(CS(this), anticheat_idle_snapaim_m10);
-       }
-       return -1;
+void anticheat_report_to_playerstats(entity this) {
+       PS_GR_P_ADDVAL(this, strcat(PLAYERSTATS_ANTICHEAT, "_time"), servertime - CS(this).anticheat_jointime);
+#define ANTICHEAT_REPORT_ONE(name, f, tmin, mi, ma) \
+       PS_GR_P_ADDVAL(this, strcat(PLAYERSTATS_ANTICHEAT, name), f)
+       ANTICHEATS(ANTICHEAT_REPORT_ONE);
+#undef ANTICHEAT_REPORT_ONE
 }
 
+void anticheat_register_to_playerstats() {
+       PlayerStats_GameReport_AddEvent(strcat(PLAYERSTATS_ANTICHEAT, "_time"));
+#define ANTICHEAT_REGISTER_ONE(name, unused_f, unused_tmin, unused_mi, unused_ma) \
+       PlayerStats_GameReport_AddEvent(strcat(PLAYERSTATS_ANTICHEAT, name))
+       ANTICHEATS(ANTICHEAT_REGISTER_ONE);
+#undef ANTICHEAT_REGISTER_ONE
+}
+
+#undef ANTICHEATS
+
 void anticheat_startframe()
 {
        anticheat_div0_evade_evasion_delta += frametime * (0.5 + random());
index 2b0522b991fb25747ce48c06003cf4433c74e30d..dd870dd397ceee549e4786adc25478f3fbb6e92e 100644 (file)
@@ -1,14 +1,14 @@
 #pragma once
 
 void anticheat_init(entity this);
-void anticheat_report(entity this);
+void anticheat_report_to_eventlog(entity this);
+void anticheat_report_to_playerstats(entity this);
+void anticheat_register_to_playerstats();
 
 void anticheat_physics(entity this);
 void anticheat_spectatecopy(entity this, entity spectatee);
 void anticheat_prethink(entity this);
 
-float anticheat_getvalue(entity this, string name);
-
 void anticheat_startframe();
 void anticheat_endframe();
 
index 56c36c0745a759e4236f3893ce08e327c12ee50f..dd44bbb4e69e88c2d64cf38037cacbe93da9601a 100644 (file)
@@ -29,6 +29,10 @@ void havocbot_ai(entity this)
        if(bot_execute_commands(this))
                return;
 
+       if(this.goalcurrent)
+       if(wasfreed(this.goalcurrent))
+               navigation_poproute(this);
+
        if (bot_strategytoken == this)
        if (!bot_strategytoken_taken)
        {
@@ -860,9 +864,6 @@ entity havocbot_gettarget(entity this, bool secondary)
 
 void havocbot_chooseenemy(entity this)
 {
-       entity head, best, head2;
-       float rating, bestrating, hf;
-       vector eye, v;
        if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(this))
        {
                this.enemy = NULL;
@@ -901,13 +902,12 @@ void havocbot_chooseenemy(entity this)
        if (time < this.havocbot_chooseenemy_finished)
                return;
        this.havocbot_chooseenemy_finished = time + autocvar_bot_ai_enemydetectioninterval;
-       eye = this.origin + this.view_ofs;
-       best = NULL;
-       bestrating = 100000000;
-       head = head2 = findchainfloat(bot_attack, true);
+       vector eye = this.origin + this.view_ofs;
+       entity best = NULL;
+       float bestrating = 100000000;
 
        // Backup hit flags
-       hf = this.dphitcontentsmask;
+       int hf = this.dphitcontentsmask;
 
        // Search for enemies, if no enemy can be seen directly try to look through transparent objects
 
@@ -920,42 +920,38 @@ void havocbot_chooseenemy(entity this)
        {
                scan_secondary_targets = false;
 LABEL(scan_targets)
-               for( ; head; head = head.chain)
+               IL_EACH(g_bot_targets, it.bot_attack,
                {
                        if(!scan_secondary_targets)
                        {
-                               if(head.classname == "misc_breakablemodel")
+                               if(it.classname == "misc_breakablemodel")
                                {
                                        have_secondary_targets = true;
                                        continue;
                                }
                        }
-                       else
-                       {
-                               if(head.classname != "misc_breakablemodel")
-                                       continue;
-                       }
+                       else if(it.classname != "misc_breakablemodel")
+                               continue;
 
-                       v = (head.absmin + head.absmax) * 0.5;
-                       rating = vlen(v - eye);
-                       if (rating<autocvar_bot_ai_enemydetectionradius)
+                       vector v = (it.absmin + it.absmax) * 0.5;
+                       float rating = vlen2(v - eye);
+                       if (vdist(v - eye, <, autocvar_bot_ai_enemydetectionradius))
                        if (bestrating > rating)
-                       if (bot_shouldattack(this, head))
+                       if (bot_shouldattack(this, it))
                        {
                                traceline(eye, v, true, this);
-                               if (trace_ent == head || trace_fraction >= 1)
+                               if (trace_ent == it || trace_fraction >= 1)
                                {
-                                       best = head;
+                                       best = it;
                                        bestrating = rating;
                                }
                        }
-               }
+               });
 
                if(!best && have_secondary_targets && !scan_secondary_targets)
                {
                        scan_secondary_targets = true;
                        // restart the loop
-                       head = head2;
                        bestrating = 100000000;
                        goto scan_targets;
                }
@@ -970,7 +966,6 @@ LABEL(scan_targets)
                // Set flags to see through transparent objects
                this.dphitcontentsmask |= DPCONTENTS_OPAQUE;
 
-               head = head2;
                scan_transparent = true;
        }
 
index 9a7997a5a6a9928e4e47217ea0e0c0018756e0ee..0d34ae3c24bc973d285c3ab07a0ab7713afbdac5 100644 (file)
@@ -1162,16 +1162,17 @@ float bot_execute_commands_once(entity this)
        // Find command
        bot_setcurrentcommand(this);
 
-       // if we have no bot command, better return
-       // old logic kept pressing previously pressed keys, but that has problems
-       // (namely, it means you cannot make a bot "normal" ever again)
-       // to keep a bot walking for a while, use the "wait" bot command
-       if(bot_cmd == NULL)
-               return false;
-
        // Ignore all commands except continue when the bot is paused
-       if(this.bot_exec_status & BOT_EXEC_STATUS_PAUSED)
-       if(bot_cmd.bot_cmd_type!=BOT_CMD_CONTINUE)
+       if(!(self.bot_exec_status & BOT_EXEC_STATUS_PAUSED))
+       {
+               // if we have no bot command, better return
+               // old logic kept pressing previously pressed keys, but that has problems
+               // (namely, it means you cannot make a bot "normal" ever again)
+               // to keep a bot walking for a while, use the "wait" bot command
+               if(bot_cmd == world)
+                       return 0;
+       }
+       else if(bot_cmd.bot_cmd_type != BOT_CMD_CONTINUE)
        {
                if(bot_cmd.bot_cmd_type!=BOT_CMD_NULL)
                {
index da66ece3bb813fa6776d5c9ad183311ba63218af..04c35a11761ffbb05b04cec53c55919c53b4a55c 100644 (file)
@@ -339,6 +339,7 @@ void PutObserverInServer(entity this)
        this.hook_time = 0;
        this.deadflag = DEAD_NO;
        this.crouch = false;
+       this.revive_progress = 0;
        this.revival_time = 0;
 
        this.items = 0;
@@ -616,6 +617,7 @@ void PutClientInServer(entity this)
                this.strength_finished = 0;
                this.invincible_finished = 0;
                this.fire_endtime = -1;
+               this.revive_progress = 0;
                this.revival_time = 0;
                this.air_finished = time + 12;
 
@@ -1050,8 +1052,8 @@ ClientPreConnect
 Called once (not at each match start) when a client begins a connection to the server
 =============
 */
-void ClientPreConnect ()
-{ENGINE_EVENT();
+void ClientPreConnect(entity this)
+{
        if(autocvar_sv_eventlog)
        {
                GameLogEcho(sprintf(":connect:%d:%d:%s",
@@ -1190,12 +1192,6 @@ void ClientConnect(entity this)
 
        if (IS_REAL_CLIENT(this))
        {
-               if (!autocvar_g_campaign)
-               {
-                       this.motd_actived_time = -1;
-                       Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOTD, getwelcomemessage(this));
-               }
-
                if (g_weaponarena_weapons == WEPSET(TUBA))
                        stuffcmd(this, "cl_cmd settemp chase_active 1\n");
        }
@@ -1222,6 +1218,15 @@ void ClientConnect(entity this)
        });
 
        MUTATOR_CALLHOOK(ClientConnect, this);
+
+       if (IS_REAL_CLIENT(this))
+       {
+               if (!autocvar_g_campaign && !IS_PLAYER(this))
+               {
+                       this.motd_actived_time = -1;
+                       Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOTD, getwelcomemessage(this));
+               }
+       }
 }
 /*
 =============
@@ -1605,11 +1610,11 @@ void player_regen(entity this)
 }
 
 bool zoomstate_set;
-void SetZoomState(entity this, float z)
+void SetZoomState(entity this, float newzoom)
 {
-       if(z != this.zoomstate)
+       if(newzoom != this.zoomstate)
        {
-               this.zoomstate = z;
+               this.zoomstate = newzoom;
                ClientData_Touch(this);
        }
        zoomstate_set = true;
index 5f2c86e4086c89d6f8bf4547f7b6659aef421785..3f8e4c47af5f31caabf33413712944ff080f037c 100644 (file)
@@ -2,7 +2,6 @@
 
 .float cmd_floodtime;
 .float cmd_floodcount;
-.float lms_spectate_warning;
 
 string MapVote_Suggest(entity this, string m);
 
index a5e4a7547a51289d1d670dca53676910de761daa..ad86afb23ce84d280d1e41316814e5a3ac9e0017 100644 (file)
@@ -49,18 +49,18 @@ float FullTraceFraction(vector a, vector mi, vector ma, vector b)
 
        return white / (black + white);
 }
-float RadarMapAtPoint_Trace(float x, float y, float w, float h, float zmin, float zsize, float q)
+float RadarMapAtPoint_Trace(float e, float f, float w, float h, float zmin, float zsize, float q)
 {
        vector a, b, mi, ma;
 
        mi = '0 0 0';
        ma = '1 0 0' * w + '0 1 0' * h;
-       a = '1 0 0' * x + '0 1 0' * y + '0 0 1' * zmin;
-       b = '1 0 0' * x + '0 1 0' * y + '0 0 1' * (zsize + zmin);
+       a = '1 0 0' * e + '0 1 0' * f + '0 0 1' * zmin;
+       b = '1 0 0' * e + '0 1 0' * f + '0 0 1' * (zsize + zmin);
 
        return FullTraceFraction(a, mi, ma, b);
 }
-float RadarMapAtPoint_LineBlock(float x, float y, float w, float h, float zmin, float zsize, float q)
+float RadarMapAtPoint_LineBlock(float e, float f, float w, float h, float zmin, float zsize, float q)
 {
        vector o, mi, ma;
        float i, r;
@@ -72,12 +72,12 @@ float RadarMapAtPoint_LineBlock(float x, float y, float w, float h, float zmin,
        mi = '0 0 0';
        dz = (zsize / q) * '0 0 1';
        ma = '1 0 0' * w + '0 1 0' * h + dz;
-       o = '1 0 0' * x + '0 1 0' * y + '0 0 1' * zmin;
+       o = '1 0 0' * e + '0 1 0' * f + '0 0 1' * zmin;
 
-       if (x < world.absmin.x - w) return 0;
-       if (y < world.absmin.y - h) return 0;
-       if (x > world.absmax.x) return 0;
-       if (y > world.absmax.y) return 0;
+       if (e < world.absmin.x - w) return 0;
+       if (f < world.absmin.y - h) return 0;
+       if (e > world.absmax.x) return 0;
+       if (f > world.absmax.y) return 0;
 
        r = 0;
        for (i = 0; i < q; ++i)
@@ -95,7 +95,7 @@ float RadarMapAtPoint_LineBlock(float x, float y, float w, float h, float zmin,
        }
        return r / q;
 }
-float RadarMapAtPoint_Block(float x, float y, float w, float h, float zmin, float zsize, float q)
+float RadarMapAtPoint_Block(float e, float f, float w, float h, float zmin, float zsize, float q)
 {
        vector o, mi, ma;
        float i, r;
@@ -107,12 +107,12 @@ float RadarMapAtPoint_Block(float x, float y, float w, float h, float zmin, floa
        mi = '0 0 0';
        dz = (zsize / q) * '0 0 1';
        ma = '1 0 0' * w + '0 1 0' * h + dz;
-       o = '1 0 0' * x + '0 1 0' * y + '0 0 1' * zmin;
+       o = '1 0 0' * e + '0 1 0' * f + '0 0 1' * zmin;
 
-       if (x < world.absmin.x - w) return 0;
-       if (y < world.absmin.y - h) return 0;
-       if (x > world.absmax.x) return 0;
-       if (y > world.absmax.y) return 0;
+       if (e < world.absmin.x - w) return 0;
+       if (f < world.absmin.y - h) return 0;
+       if (e > world.absmax.x) return 0;
+       if (f > world.absmax.y) return 0;
 
        r = 0;
        for (i = 0; i < q; ++i)
@@ -122,7 +122,7 @@ float RadarMapAtPoint_Block(float x, float y, float w, float h, float zmin, floa
        }
        return r / q;
 }
-float RadarMapAtPoint_Sample(float x, float y, float w, float h, float zmin, float zsize, float q)
+float RadarMapAtPoint_Sample(float e, float f, float w, float h, float zmin, float zsize, float q)
 {
        vector a, b, mi, ma;
 
@@ -133,7 +133,7 @@ float RadarMapAtPoint_Sample(float x, float y, float w, float h, float zmin, flo
 
        mi = '0 0 0';
        ma = '1 0 0' * w + '0 1 0' * h;
-       a = '1 0 0' * x + '0 1 0' * y + '0 0 1' * zmin;
+       a = '1 0 0' * e + '0 1 0' * f + '0 0 1' * zmin;
        b = '1 0 0' * w + '0 1 0' * h + '0 0 1' * zsize;
 
        float c, i;
@@ -151,31 +151,31 @@ float RadarMapAtPoint_Sample(float x, float y, float w, float h, float zmin, flo
 
        return c / q;
 }
-void sharpen_set(int x, float v)
+void sharpen_set(int b, float v)
 {
-       sharpen_buffer[x + 2 * RADAR_WIDTH_MAX] = v;
+       sharpen_buffer[b + 2 * RADAR_WIDTH_MAX] = v;
 }
-float sharpen_getpixel(int x, int y)
+float sharpen_getpixel(int b, int c)
 {
-       if (x < 0) return 0;
-       if (x >= RADAR_WIDTH_MAX) return 0;
-       if (y < 0) return 0;
-       if (y > 2) return 0;
-       return sharpen_buffer[x + y * RADAR_WIDTH_MAX];
+       if (b < 0) return 0;
+       if (b >= RADAR_WIDTH_MAX) return 0;
+       if (c < 0) return 0;
+       if (c > 2) return 0;
+       return sharpen_buffer[b + c * RADAR_WIDTH_MAX];
 }
-float sharpen_get(float x, float a)
+float sharpen_get(float b, float a)
 {
-       float sum = sharpen_getpixel(x, 1);
+       float sum = sharpen_getpixel(b, 1);
        if (a == 0) return sum;
        sum *= (8 + 1 / a);
-       sum -= sharpen_getpixel(x - 1, 0);
-       sum -= sharpen_getpixel(x - 1, 1);
-       sum -= sharpen_getpixel(x - 1, 2);
-       sum -= sharpen_getpixel(x + 1, 0);
-       sum -= sharpen_getpixel(x + 1, 1);
-       sum -= sharpen_getpixel(x + 1, 2);
-       sum -= sharpen_getpixel(x, 0);
-       sum -= sharpen_getpixel(x, 2);
+       sum -= sharpen_getpixel(b - 1, 0);
+       sum -= sharpen_getpixel(b - 1, 1);
+       sum -= sharpen_getpixel(b - 1, 2);
+       sum -= sharpen_getpixel(b + 1, 0);
+       sum -= sharpen_getpixel(b + 1, 1);
+       sum -= sharpen_getpixel(b + 1, 2);
+       sum -= sharpen_getpixel(b, 0);
+       sum -= sharpen_getpixel(b, 2);
        return bound(0, sum * a, 1);
 }
 void sharpen_shift(int w)
index cbc65680a0aed6dcf309bd88ebd5069c61f87b5e..1e5fedbcb65b79d209fff4de1fd2e7b11045a861 100644 (file)
@@ -226,7 +226,7 @@ void GameCommand_anticheat(float request, float argc)
 
                        if (accepted > 0)
                        {
-                               anticheat_report(client);
+                               anticheat_report_to_eventlog(client);
                                return;
                        }
                        else
@@ -1328,7 +1328,7 @@ void GameCommand_shuffleteams(float request)
                {
                        if (teamplay)
                        {
-                               float x, t_teams, t_players, team_color;
+                               float t_teams, t_players, team_color;
 
                                // count the total amount of players and total amount of teams
                                t_players = 0;
@@ -1366,15 +1366,15 @@ void GameCommand_shuffleteams(float request)
                                for (int i = 1; i <= t_teams; ++i)
                                {
                                        // find out how many players to assign to this team
-                                       x = (t_players / t_teams);
-                                       x = ((i == 1) ? ceil(x) : floor(x));
+                                       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] >= x))
+                                               if (!(shuffleteams_teams[i] >= pnum))
                                                {
                                                        if (!(shuffleteams_players[z])) continue;  // not a player, move on to next random slot
 
index d1cdb7e59db5a2c766aeb76ef907c7a5a198f64b..85c5d18472f82b08f94ff695c220ae2181761662 100644 (file)
@@ -334,7 +334,13 @@ void VoteThink()
 // Resets the state of all clients, items, weapons, waypoints, ... of the map.
 void reset_map(bool dorespawn)
 {
-       if (time <= game_starttime && round_handler_IsActive()) round_handler_Reset(game_starttime);
+       if (time <= game_starttime)
+       {
+               if (gameover)
+                       return;
+               if (round_handler_IsActive())
+                       round_handler_Reset(game_starttime);
+       }
 
        MUTATOR_CALLHOOK(reset_map_global);
 
@@ -399,6 +405,9 @@ void ReadyRestart_think(entity this)
 // Forces a restart of the game without actually reloading the map // this is a mess...
 void ReadyRestart_force()
 {
+       if (time <= game_starttime && gameover)
+               return;
+
        bprint("^1Server is restarting...\n");
 
        VoteReset();
index e90dbeb9669a81e00cc94cb6651094e015081c4d..7f4899f127faed3c1d53e77e9ad15a4d236f197b 100644 (file)
@@ -238,6 +238,9 @@ string formatmessage(entity this, string msg)
        cursor = trace_endpos;
        cursor_ent = trace_ent;
 
+       MUTATOR_CALLHOOK(PreFormatMessage, this, msg);
+       msg = M_ARGV(1, string);
+
        while (1) {
                if (n < 1)
                        break; // too many replacements
index 21c8ef9a5c114e92b0650f4ca5b6ec251a14d3a5..b6e8c7f4b7b233f38edc3bf18e5c45417db27285 100644 (file)
@@ -134,6 +134,14 @@ MUTATOR_HOOKABLE(SpectateCopy, EV_SpectateCopy);
     /**/
 MUTATOR_HOOKABLE(FormatMessage, EV_FormatMessage);
 
+/** called before any formatting is applied, handy for tweaking the message before scripts get ahold of it */
+#define EV_PreFormatMessage(i, o) \
+    /** player        */ i(entity, MUTATOR_ARGV_0_entity) \
+    /** message       */ i(string, MUTATOR_ARGV_1_string) \
+    /**/                 o(string, MUTATOR_ARGV_1_string) \
+    /**/
+MUTATOR_HOOKABLE(PreFormatMessage, EV_PreFormatMessage);
+
 /** returns true if throwing the current weapon shall not be allowed */
 #define EV_ForbidThrowCurrentWeapon(i, o) \
     /** player        */ i(entity, MUTATOR_ARGV_0_entity) \
index 8009feb8a569c252694450672b86367b5ced92be..5aba748fd5348207e81b7dacdbde39288fbde814 100644 (file)
@@ -6,7 +6,7 @@ int autocvar_g_ca_point_limit;
 int autocvar_g_ca_point_leadlimit;
 float autocvar_g_ca_round_timelimit;
 bool autocvar_g_ca_team_spawns;
-int autocvar_g_ca_teams;
+//int autocvar_g_ca_teams;
 int autocvar_g_ca_teams_override;
 float autocvar_g_ca_warmup;
 
@@ -33,7 +33,8 @@ REGISTER_MUTATOR(ca, false)
                allowed_to_spawn = true;
 
                ca_teams = autocvar_g_ca_teams_override;
-               if (ca_teams < 2) ca_teams = autocvar_g_ca_teams;
+               if (ca_teams < 2)
+                       ca_teams = cvar("g_ca_teams"); // read the cvar directly as it gets written earlier in the same frame
                ca_teams = bound(2, ca_teams, 4);
 
                int teams = 0;
index eb94e4f263f75a57b21b0e0a1cb8b5b52d197fd5..7f98ed289cd990a2041834270a58181ce0190b16 100644 (file)
@@ -631,7 +631,10 @@ void dom_DelayedInit(entity this) // Do this check with a delay so we can wait f
        if(find(NULL, classname, "dom_team") == NULL || autocvar_g_domination_teams_override >= 2)
        {
                LOG_TRACE("No \"dom_team\" entities found on this map, creating them anyway.");
-               domination_teams = bound(2, ((autocvar_g_domination_teams_override < 2) ? autocvar_g_domination_default_teams : autocvar_g_domination_teams_override), 4);
+               domination_teams = autocvar_g_domination_teams_override;
+               if (domination_teams < 2)
+                       domination_teams = autocvar_g_domination_default_teams;
+               domination_teams = bound(2, domination_teams, 4);
                dom_spawnteams(domination_teams);
        }
 
index 32c91d8c17d20fb6f6e9fdaeb4eb9b0f0e31ec98..cec7d950e9076cdecfc573fdaeafe9be16f409e2 100644 (file)
@@ -3,7 +3,7 @@
 float autocvar_g_freezetag_frozen_maxtime;
 float autocvar_g_freezetag_revive_clearspeed;
 float autocvar_g_freezetag_round_timelimit;
-int autocvar_g_freezetag_teams;
+//int autocvar_g_freezetag_teams;
 int autocvar_g_freezetag_teams_override;
 float autocvar_g_freezetag_warmup;
 
@@ -573,7 +573,7 @@ void freezetag_Initialize()
 {
        freezetag_teams = autocvar_g_freezetag_teams_override;
        if(freezetag_teams < 2)
-               freezetag_teams = autocvar_g_freezetag_teams;
+               freezetag_teams = cvar("g_freezetag_teams"); // read the cvar directly as it gets written earlier in the same frame
        freezetag_teams = bound(2, freezetag_teams, 4);
 
        int teams = 0;
index efed23a5df41f48dd0897ffb72c8434412f1cb47..1496feec595cdd2ec0fb83b0026ba267ae7380a7 100644 (file)
@@ -23,28 +23,18 @@ spawnfunc(invasion_spawnpoint)
 
        this.classname = "invasion_spawnpoint";
        IL_PUSH(g_invasion_spawns, this);
-
-       if(autocvar_g_invasion_zombies_only) // precache only if it hasn't been already
-       if(this.spawnmob)
-       {
-               FOREACH(Monsters, it.netname == this.spawnmob,
-               {
-                       it.mr_precache(it);
-               });
-       }
 }
 
 Monster invasion_PickMonster(int supermonster_count)
 {
-       if(autocvar_g_invasion_zombies_only)
-               return MON_ZOMBIE;
-
        RandomSelection_Init();
 
        FOREACH(Monsters, it != MON_Null,
        {
                if((it.spawnflags & MONSTER_TYPE_PASSIVE) || (it.spawnflags & MONSTER_TYPE_FLY) || (it.spawnflags & MONSTER_TYPE_SWIM) || (it.spawnflags & MONSTER_SIZE_QUAKE) || ((it.spawnflags & MON_FLAG_SUPERMONSTER) && supermonster_count >= 1))
                        continue;
+               if(autocvar_g_invasion_zombies_only && !(it.spawnflags & MONSTER_TYPE_UNDEAD))
+                       continue;
         RandomSelection_AddEnt(it, 1, 1);
        });
 
@@ -77,11 +67,18 @@ void invasion_SpawnChosenMonster(Monster mon)
                setsize(e, mon.mins, mon.maxs);
 
                if(MoveToRandomMapLocation(e, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, 10, 1024, 256))
-                       monster = spawnmonster(e, "", mon.m_id, NULL, NULL, e.origin, false, false, 2);
-               else return;
+                       monster = spawnmonster(e, "", mon.monsterid, NULL, NULL, e.origin, false, false, 2);
+               else
+               {
+                       delete(e);
+                       return;
+               }
        }
        else // if spawnmob field falls through (unset), fallback to mon (relying on spawnmonster for that behaviour)
-               monster = spawnmonster(spawn(), spawn_point.spawnmob, mon.m_id, spawn_point, spawn_point, spawn_point.origin, false, false, 2);
+               monster = spawnmonster(spawn(), spawn_point.spawnmob, mon.monsterid, spawn_point, spawn_point, spawn_point.origin, false, false, 2);
+
+       if(!monster)
+               return;
 
        if(spawn_point) monster.target2 = spawn_point.target2;
        monster.spawnshieldtime = time;
@@ -465,22 +462,5 @@ void invasion_DelayedInit(entity this) // Do this check with a delay so we can w
 
 void invasion_Initialize()
 {
-       if(autocvar_g_invasion_zombies_only) {
-               Monster mon = MON_ZOMBIE;
-               mon.mr_precache(mon);
-       } else
-       {
-               float i;
-               entity mon;
-               for(i = MON_FIRST; i <= MON_LAST; ++i)
-               {
-                       mon = get_monsterinfo(i);
-                       if((mon.spawnflags & MONSTER_TYPE_FLY) || (mon.spawnflags & MONSTER_TYPE_SWIM))
-                               continue; // flying/swimming monsters not yet supported
-
-                       mon.mr_precache(mon);
-               }
-       }
-
        InitializeEntity(NULL, invasion_DelayedInit, INITPRIO_GAMETYPE);
 }
index 944311598090c80e7f19f489ed2631ff52d1ff47..e4918ee14b03e85a9cbb2e2a24a56f8a62cccd8a 100644 (file)
@@ -17,7 +17,7 @@ int autocvar_g_balance_keyhunt_score_destroyed_ownfactor;
 int autocvar_g_balance_keyhunt_score_push;
 float autocvar_g_balance_keyhunt_throwvelocity;
 
-int autocvar_g_keyhunt_teams;
+//int autocvar_g_keyhunt_teams;
 int autocvar_g_keyhunt_teams_override;
 
 // #define KH_PLAYER_USE_ATTACHMENT
@@ -441,7 +441,8 @@ void kh_Key_Collect(entity key, entity player)  //a player picks up a dropped ke
                PlayerScore_Add(player, SP_KH_PICKUPS, 1);
        }
        key.kh_dropperteam = 0;
-       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(key.team, INFO_KEYHUNT_PICKUP), player.netname);
+       int realteam = kh_Team_ByID(key.count);
+       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(realteam, INFO_KEYHUNT_PICKUP), player.netname);
 
        kh_Key_AssignTo(key, player); // this also updates .kh_state
 }
@@ -661,7 +662,8 @@ void kh_LoserTeam(float teem, entity lostkey)  // runs when a player pushes a fl
                }
        }
 
-       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(lostkey.team, INFO_KEYHUNT_LOST), lostkey.kh_previous_owner.netname);
+       int realteam = kh_Team_ByID(lostkey.count);
+       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(realteam, INFO_KEYHUNT_LOST), lostkey.kh_previous_owner.netname);
 
        play2all(SND(KH_DESTROY));
        te_tarexplosion(lostkey.origin);
@@ -814,7 +816,8 @@ void kh_Key_DropOne(entity key)
 
        kh_Scores_Event(player, key, "dropkey", 0, 0);
        PlayerScore_Add(player, SP_KH_LOSSES, 1);
-       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(key.team, INFO_KEYHUNT_DROP), player.netname);
+       int realteam = kh_Team_ByID(key.count);
+       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(realteam, INFO_KEYHUNT_DROP), player.netname);
 
        kh_Key_AssignTo(key, NULL);
        makevectors(player.v_angle);
@@ -840,7 +843,8 @@ void kh_Key_DropAll(entity player, float suicide) // runs whenever a player dies
                {
                        kh_Scores_Event(player, key, "losekey", 0, 0);
                        PlayerScore_Add(player, SP_KH_LOSSES, 1);
-                       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(key.team, INFO_KEYHUNT_LOST), player.netname);
+                       int realteam = kh_Team_ByID(key.count);
+                       Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(realteam, INFO_KEYHUNT_LOST), player.netname);
                        kh_Key_AssignTo(key, NULL);
                        makevectors('-1 0 0' * (45 + 45 * random()) + '0 360 0' * random());
                        key.velocity = W_CalculateProjectileVelocity(player, player.velocity, autocvar_g_balance_keyhunt_dropvelocity * v_forward, false);
@@ -988,7 +992,7 @@ void kh_Initialize()  // sets up th KH environment
        // setup variables
        kh_teams = autocvar_g_keyhunt_teams_override;
        if(kh_teams < 2)
-               kh_teams = autocvar_g_keyhunt_teams;
+               kh_teams = cvar("g_keyhunt_teams"); // read the cvar directly as it gets written earlier in the same frame
        kh_teams = bound(2, kh_teams, 4);
 
        int teams = 0;
index 793cbf6b76f38fc2a38c9181581e750c32d02dd8..25f6d3e0ab03ae441a08313a3606bf7869222b25 100644 (file)
@@ -72,7 +72,10 @@ int WinningCondition_LMS()
                                // a winner!
                                // and assign him his first place
                                PlayerScore_Add(head, SP_LMS_RANK, 1);
-                               return WINNING_YES;
+                               if(warmup_stage)
+                                       return WINNING_NO;
+                               else
+                                       return WINNING_YES;
                        }
                }
        }
@@ -110,26 +113,50 @@ int WinningCondition_LMS()
 MUTATOR_HOOKFUNCTION(lms, reset_map_global)
 {
        lms_lowest_lives = 999;
-       lms_next_place = player_count;
 }
 
 MUTATOR_HOOKFUNCTION(lms, reset_map_players)
 {
-       if(restart_mapalreadyrestarted || (time < game_starttime))
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(PlayerScore_Add(it, SP_LMS_LIVES, LMS_NewPlayerLives())));
+       FOREACH_CLIENT(true, {
+               TRANSMUTE(Player, it);
+               it.frags = FRAGS_PLAYER;
+               PlayerScore_Add(it, SP_LMS_LIVES, LMS_NewPlayerLives());
+               PutClientInServer(it);
+       });
 }
 
 MUTATOR_HOOKFUNCTION(lms, PutClientInServer)
 {
        entity player = M_ARGV(0, entity);
 
-       // player is dead and becomes observer
-       // FIXME fix LMS scoring for new system
-       if(PlayerScore_Add(player, SP_LMS_RANK, 0) > 0)
-       {
+       if(player.frags == FRAGS_SPECTATOR)
                TRANSMUTE(Observer, player);
+       else
+       {
+               float tl = PlayerScore_Add(player, SP_LMS_LIVES, 0);
+               if(tl < lms_lowest_lives)
+                       lms_lowest_lives = tl;
+               if(tl <= 0)
+                       TRANSMUTE(Observer, player);
+               if(warmup_stage)
+                       PlayerScore_Add(player, SP_LMS_RANK, -PlayerScore_Add(player, SP_LMS_RANK, 0));
+       }
+}
+
+MUTATOR_HOOKFUNCTION(lms, ForbidSpawn)
+{
+       entity player = M_ARGV(0, entity);
+
+       if(warmup_stage)
+               return false;
+       if(player.frags == FRAGS_SPECTATOR)
+               return true;
+       if(PlayerScore_Add(player, SP_LMS_LIVES, 0) <= 0)
+       {
                Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_LMS_NOLIVES);
+               return true;
        }
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(lms, PlayerDies)
@@ -141,14 +168,48 @@ MUTATOR_HOOKFUNCTION(lms, PlayerDies)
 
 void lms_RemovePlayer(entity player)
 {
-       // Only if the player cannot play at all
-       if(PlayerScore_Add(player, SP_LMS_RANK, 0) == 666)
-               player.frags = FRAGS_SPECTATOR;
-       else
+       static int quitters = 0;
+       float player_rank = PlayerScore_Add(player, SP_LMS_RANK, 0);
+       if (!player_rank)
        {
-               if(IS_BOT_CLIENT(player))
-                       bot_clear(player);
-               player.frags = FRAGS_LMS_LOSER;
+               int pl_cnt = 0;
+               FOREACH_CLIENT(IS_PLAYER(it), { pl_cnt++; });
+               if (player.lms_spectate_warning != 2)
+               {
+                       if(IS_BOT_CLIENT(player))
+                               bot_clear(player);
+                       player.frags = FRAGS_LMS_LOSER;
+                       PlayerScore_Add(player, SP_LMS_RANK, pl_cnt + 1);
+               }
+               else
+               {
+                       lms_lowest_lives = 999;
+                       FOREACH_CLIENT(true, {
+                               if (it.frags == FRAGS_LMS_LOSER)
+                               {
+                                       float it_rank = PlayerScore_Add(it, SP_LMS_RANK, 0);
+                                       if (it_rank > player_rank && it_rank <= 256)
+                                               PlayerScore_Add(it, SP_LMS_RANK, -1);
+                                       lms_lowest_lives = 0;
+                               }
+                               else if (it.frags != FRAGS_SPECTATOR)
+                               {
+                                       float tl = PlayerScore_Add(it, SP_LMS_LIVES, 0);
+                                       if(tl < lms_lowest_lives)
+                                               lms_lowest_lives = tl;
+                               }
+                       });
+                       PlayerScore_Add(player, SP_LMS_RANK, 665 - quitters); // different from 666
+                       if(!warmup_stage)
+                       {
+                               PlayerScore_Add(player, SP_LMS_LIVES, -PlayerScore_Add(player, SP_LMS_LIVES, 0));
+                               ++quitters;
+                       }
+                       player.frags = FRAGS_LMS_LOSER;
+                       TRANSMUTE(Observer, player);
+               }
+               if (pl_cnt == 2 && !warmup_stage) // a player is forfeiting leaving only one player
+                       lms_lowest_lives = 0; // end the game now!
        }
 
        if(player.killcount != FRAGS_SPECTATOR)
@@ -182,7 +243,7 @@ MUTATOR_HOOKFUNCTION(lms, ClientConnect)
 
        if(PlayerScore_Add(player, SP_LMS_LIVES, LMS_NewPlayerLives()) <= 0)
        {
-               PlayerScore_Add(player, SP_LMS_RANK, 666);
+               PlayerScore_Add(player, SP_LMS_RANK, 666); // mark as forced spectator for the hud code
                player.frags = FRAGS_SPECTATOR;
        }
 }
@@ -212,21 +273,23 @@ MUTATOR_HOOKFUNCTION(lms, GiveFragsForKill)
 {
        entity frag_target = M_ARGV(1, entity);
 
-       // remove a life
-       float tl;
-       tl = PlayerScore_Add(frag_target, SP_LMS_LIVES, -1);
-       if(tl < lms_lowest_lives)
-               lms_lowest_lives = tl;
-       if(tl <= 0)
+       if (!warmup_stage)
        {
-               if(!lms_next_place)
-                       lms_next_place = player_count;
-               else
-                       lms_next_place = min(lms_next_place, player_count);
-               PlayerScore_Add(frag_target, SP_LMS_RANK, lms_next_place); // won't ever spawn again
-               --lms_next_place;
+               // remove a life
+               int tl = PlayerScore_Add(frag_target, SP_LMS_LIVES, -1);
+               if(tl < lms_lowest_lives)
+                       lms_lowest_lives = tl;
+               if(tl <= 0)
+               {
+                       int pl_cnt = 0;
+                       FOREACH_CLIENT(IS_PLAYER(it), { pl_cnt++; });
+                       if(IS_BOT_CLIENT(frag_target))
+                               bot_clear(frag_target);
+                       frag_target.frags = FRAGS_LMS_LOSER;
+                       PlayerScore_Add(frag_target, SP_LMS_RANK, pl_cnt);
+               }
        }
-       M_ARGV(2, float) = 0;
+       M_ARGV(2, float) = 0; // frag score
 
        return true;
 }
@@ -305,8 +368,8 @@ MUTATOR_HOOKFUNCTION(lms, ItemTouch)
 MUTATOR_HOOKFUNCTION(lms, Bot_FixCount, CBC_ORDER_EXCLUSIVE)
 {
        FOREACH_CLIENT(IS_REAL_CLIENT(it), LAMBDA(
-               ++M_ARGV(0, int);
-               ++M_ARGV(1, int);
+               ++M_ARGV(0, int); // activerealplayers
+               ++M_ARGV(1, int); // realplayers
        ));
 
        return true;
@@ -316,17 +379,18 @@ MUTATOR_HOOKFUNCTION(lms, ClientCommand_Spectate)
 {
     entity player = M_ARGV(0, entity);
 
-       if(player.lms_spectate_warning)
+       if(warmup_stage || player.lms_spectate_warning)
        {
                // for the forfeit message...
                player.lms_spectate_warning = 2;
-               // mark player as spectator
-               PlayerScore_Add(player, SP_LMS_RANK, 666 - PlayerScore_Add(player, SP_LMS_RANK, 0));
        }
        else
        {
-               player.lms_spectate_warning = 1;
-               sprint(player, "WARNING: you won't be able to enter the game again after spectating in LMS. Use the same command again to spectate anyway.\n");
+               if(player.frags != FRAGS_SPECTATOR && player.frags != FRAGS_LMS_LOSER)
+               {
+                       player.lms_spectate_warning = 1;
+                       sprint(player, "WARNING: you won't be able to enter the game again after spectating in LMS. Use the same command again to spectate anyway.\n");
+               }
                return MUT_SPECCMD_RETURN;
        }
        return MUT_SPECCMD_CONTINUE;
@@ -367,7 +431,6 @@ void lms_ScoreRules()
 void lms_Initialize()
 {
        lms_lowest_lives = 9999;
-       lms_next_place = 0;
 
        lms_ScoreRules();
 }
index 7bf012668efb075a468a8e536fd405fb0d9e85ce..1f1d2d4c3419654509a7d402f42fe41cbbdaa3ea 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "../gamemode.qh"
 
+.float lms_spectate_warning;
 #define autocvar_g_lms_lives_override cvar("g_lms_lives_override")
 void lms_Initialize();
 
@@ -34,5 +35,4 @@ REGISTER_MUTATOR(lms, false)
 
 // lives related defs
 float lms_lowest_lives;
-float lms_next_place;
 float LMS_NewPlayerLives();
index 044d6444347d5f93929daa74ffe832da4f1590f1..36c7c1d3147968284bf8a478c68f145cb7e965e6 100644 (file)
@@ -297,11 +297,11 @@ void pathlib_cleanup()
 
 }
 
-float Cosine_Interpolate(float a, float b, float x)
+float Cosine_Interpolate(float a, float b, float c)
 {
     float ft,f;
 
-       ft = x * 3.1415927;
+       ft = c * 3.1415927;
        f = (1 - cos(ft)) * 0.5;
 
        return  a*(1-f) + b*f;
index 904447c218418c936f5f933cce7cf13062813c61..9125b50d7cab1969108371ed2bd744194387495f 100644 (file)
@@ -323,6 +323,9 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
                        damage /= sqrt(bound(1.0, attacker.cvar_cl_handicap, 100.0));
        }
 
+       if (time < this.spawnshieldtime && autocvar_g_spawnshield_blockdamage < 1)
+               damage *= 1 - max(0, autocvar_g_spawnshield_blockdamage);
+
        if(DEATH_ISWEAPON(deathtype, WEP_TUBA))
        {
                // tuba causes blood to come out of the ears
@@ -357,7 +360,6 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
        else
                Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, this, attacker);
 
-
        v = healtharmor_applydamage(this.armorvalue, autocvar_g_balance_armor_blockpercent, deathtype, damage);
        take = v.x;
        save = v.y;
@@ -386,13 +388,6 @@ void PlayerDamage(entity this, entity inflictor, entity attacker, float damage,
                this.istypefrag = 0;
        }
 
-       if (time < this.spawnshieldtime && autocvar_g_spawnshield_blockdamage < 1)
-       {
-               vector v = healtharmor_applydamage(this.armorvalue, max(0, autocvar_g_spawnshield_blockdamage), deathtype, damage);
-               take = v.x;
-               save = v.y;
-       }
-
        MUTATOR_CALLHOOK(PlayerDamage_SplitHealthArmor, inflictor, attacker, this, force, take, save, deathtype, damage);
        take = bound(0, M_ARGV(4, float), this.health);
        save = bound(0, M_ARGV(5, float), this.armorvalue);
index 3b11c5f9b6f409e0d51948286cab7160041b3270..8cc3295b9a5d4acfe8d59a7f77585e115a30ccf3 100644 (file)
@@ -1,5 +1,6 @@
 #include "round_handler.qh"
 
+#include "campaign.qh"
 #include "command/vote.qh"
 #include "../common/util.qh"
 
@@ -28,7 +29,7 @@ void round_handler_Think(entity this)
 
        if (this.cnt > 0)  // countdown running
        {
-               if (this.canRoundStart())
+               if (this.canRoundStart() && !(autocvar_g_campaign && !campaign_bots_may_start))
                {
                        if (this.cnt == this.count + 1) round_starttime = time + this.count;
                        int f = this.cnt - 1;