]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote branch 'origin/fruitiex/nexballtextures'
authorRudolf Polzer <divverent@alientrap.org>
Sun, 7 Nov 2010 14:24:10 +0000 (15:24 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Sun, 7 Nov 2010 14:24:10 +0000 (15:24 +0100)
44 files changed:
Makefile
balance25.cfg
balanceTest.cfg
balanceXonotic.cfg
defaultXonotic.cfg
effectinfo.txt
gfx/menu/default/icon_aeslevel1.tga
gfx/menu/default/icon_aeslevel2.tga
gfx/menu/default/icon_aeslevel3.tga
gfx/menu/default/icon_aeslevel4.tga
gfx/menu/default/icon_aeslevel5.tga
gfx/menu/luminos/icon_aeslevel1.tga
gfx/menu/luminos/icon_aeslevel2.tga
gfx/menu/luminos/icon_aeslevel3.tga
gfx/menu/luminos/icon_aeslevel4.tga
gfx/menu/luminos/icon_aeslevel5.tga
gfx/menu/xaw/icon_aeslevel1.tga
gfx/menu/xaw/icon_aeslevel2.tga
gfx/menu/xaw/icon_aeslevel3.tga
gfx/menu/xaw/icon_aeslevel4.tga
gfx/menu/xaw/icon_aeslevel5.tga
qcsrc/client/Main.qc
qcsrc/client/autocvars.qh
qcsrc/client/hud.qc
qcsrc/client/scoreboard.qc
qcsrc/common/constants.qh
qcsrc/common/gamecommand.qc
qcsrc/common/mapinfo.qc
qcsrc/common/mapinfo.qh
qcsrc/common/util.qh
qcsrc/menu/xonotic/dialog_multiplayer_join_serverinfo.c
qcsrc/menu/xonotic/playerlist.c
qcsrc/menu/xonotic/weaponslist.c
qcsrc/server/cl_client.qc
qcsrc/server/cl_physics.qc
qcsrc/server/clientcommands.qc
qcsrc/server/defs.qh
qcsrc/server/g_violence.qc
qcsrc/server/g_world.qc
qcsrc/server/gamecommand.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/race.qc
qcsrc/server/t_quake3.qc
qcsrc/server/w_shotgun.qc

index aa4554f19c70f2b3b109a915fded99b71629efd8..e71d9d1c10d656da49ad3a9901544c6646907149 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -6,8 +6,7 @@ ZIPEXCLUDE ?= -x\!*.pk3 -xr\!\.svn -x\!qcsrc
 DIFF ?= diff
 
 FTEQCCFLAGS_WATERMARK ?= -DWATERMARK='"^1$(shell git describe) TEST BUILD"'
-#FTEQCCFLAGS ?= -Werror -Wno-Q205 -Wno-Q302 -O3 -Ono-c -Ono-cs $(FTEQCCFLAGS_EXTRA) $(FTEQCCFLAGS_WATERMARK)
-FTEQCCFLAGS ?= -Wno-Q302 -O3 -Ono-c -Ono-cs $(FTEQCCFLAGS_EXTRA) $(FTEQCCFLAGS_WATERMARK)
+FTEQCCFLAGS ?= -Werror -Wno-Q302 -O3 -Ono-c -Ono-cs $(FTEQCCFLAGS_EXTRA) $(FTEQCCFLAGS_WATERMARK)
 FTEQCCFLAGS_PROGS ?=
 FTEQCCFLAGS_MENU ?=
 
index 22fdaf09dcce3f01b2386439d1575f56d9c1ca49..1df67732efaff258f9ea300ca2b4d9e8fd0ba3a2 100644 (file)
@@ -16,7 +16,7 @@ set g_start_weapon_hlac -1 "0 = never provide the weapon, 1 = always provide the
 set g_start_weapon_campingrifle -1 "0 = never provide the weapon, 1 = always provide the weapon, -1 = game mode default, -2 = provide the weapon in ca and lms"
 set g_start_weapon_tuba -1 "0 = never provide the weapon, 1 = always provide the weapon, -1 = game mode default, -2 = provide the weapon in ca and lms"
 set g_start_weapon_fireball -1 "0 = never provide the weapon, 1 = always provide the weapon, -1 = game mode default, -2 = provide the weapon in ca and lms"
-set g_start_weapon_seeker 0 "0 = never provide the weapon, 1 = always provide the weapon, -1 = game mode default, -2 = provide the weapon in ca and lms"
+set g_start_weapon_seeker -1 "0 = never provide the weapon, 1 = always provide the weapon, -1 = game mode default, -2 = provide the weapon in ca and lms"
 set g_balance_health_start 150
 set g_balance_armor_start 0
 set g_start_ammo_shells 40
@@ -222,7 +222,7 @@ set g_balance_laser_primary_refire 0.7
 set g_balance_laser_primary_animtime 0.3
 set g_balance_laser_primary_lifetime 30
 set g_balance_laser_primary_shotangle 0
-set g_balance_laser_primary_delay 0
+set g_balance_laser_primary_delay 0.05
 set g_balance_laser_primary_gauntlet 0
 set g_balance_laser_secondary 0 // when 1, a secondary laser mode exists
 set g_balance_laser_secondary_damage 35
index 897b5698d8aec84b9ffb705b5b688a494c1671ed..7defd001f794853cd137d0b40e8184d751276465 100644 (file)
@@ -17,7 +17,7 @@ set g_start_weapon_campingrifle -1 "0 = never provide the weapon, 1 = always pro
 set g_start_weapon_tuba -1 "0 = never provide the weapon, 1 = always provide the weapon, -1 = game mode default, -2 = provide the weapon in ca and lms"
 set g_start_weapon_fireball -1 "0 = never provide the weapon, 1 = always provide the weapon, -1 = game mode default, -2 = provide the weapon in ca and lms"
 set g_start_weapon_seeker -1 "0 = never provide the weapon, 1 = always provide the weapon, -1 = game mode default, -2 = provide the weapon in ca and lms"
-set g_balance_health_start 125
+set g_balance_health_start 150
 set g_balance_armor_start 0
 set g_start_ammo_shells 20
 set g_start_ammo_nails 0
@@ -115,18 +115,18 @@ set g_balance_health_regenlinear 0
 set g_balance_pause_health_regen 5
 set g_balance_pause_health_regen_spawn 0
 set g_balance_health_rot 0.1
-set g_balance_health_rotlinear 0
-set g_balance_pause_health_rot 5
-set g_balance_pause_health_rot_spawn 10
+set g_balance_health_rotlinear 2.5
+set g_balance_pause_health_rot 4
+set g_balance_pause_health_rot_spawn 8
 set g_balance_health_regenstable 100
 set g_balance_health_rotstable 100
 set g_balance_health_limit 999
 set g_balance_armor_regen 0
 set g_balance_armor_regenlinear 0
 set g_balance_armor_rot 0.1
-set g_balance_armor_rotlinear 0
-set g_balance_pause_armor_rot 5
-set g_balance_pause_armor_rot_spawn 10
+set g_balance_armor_rotlinear 2.5
+set g_balance_pause_armor_rot 4
+set g_balance_pause_armor_rot_spawn 8
 set g_balance_armor_regenstable 100
 set g_balance_armor_rotstable 100
 set g_balance_armor_limit 999
@@ -136,8 +136,8 @@ set g_balance_fuel_regenlinear 0
 set g_balance_pause_fuel_regen 2 // other than this, fuel uses the health regen counter
 set g_balance_fuel_rot 0.05
 set g_balance_fuel_rotlinear 0
-set g_balance_pause_fuel_rot 5
-set g_balance_pause_fuel_rot_spawn 10
+set g_balance_pause_fuel_rot 4
+set g_balance_pause_fuel_rot_spawn 8
 set g_balance_fuel_regenstable 50
 set g_balance_fuel_rotstable 100
 set g_balance_fuel_limit 999
@@ -222,7 +222,7 @@ set g_balance_laser_primary_refire 0.6
 set g_balance_laser_primary_animtime 0.6
 set g_balance_laser_primary_lifetime 5
 set g_balance_laser_primary_shotangle 0
-set g_balance_laser_primary_delay 0
+set g_balance_laser_primary_delay 0.03
 set g_balance_laser_primary_gauntlet 0
 set g_balance_laser_secondary 0 // when 1, a secondary laser mode exists
 set g_balance_laser_secondary_damage 35
index a421e98dc7940ce03c5d444d024623abaa17d5e0..d50669f3a00875831821987dd17098175c51560f 100644 (file)
@@ -382,7 +382,7 @@ set g_balance_crylink_primary_damage 8
 set g_balance_crylink_primary_edgedamage 6
 set g_balance_crylink_primary_force 40
 set g_balance_crylink_primary_radius 80
-set g_balance_crylink_primary_speed 1100
+set g_balance_crylink_primary_speed 1200
 set g_balance_crylink_primary_spread 0.1
 set g_balance_crylink_primary_shots 7
 set g_balance_crylink_primary_bounces 2
index 84157c2bf78089c1f3f9ac64adfc08f2ff012029..dea1f3790e365eae4450b820ab726371e0bc59e3 100644 (file)
@@ -630,8 +630,9 @@ set g_ons_respawn_waves 0
 set g_rc_respawn_waves 0
 set g_rc_respawn_delay 0
 set g_cts_respawn_waves 0
-set g_cts_respawn_delay 0
+set g_cts_respawn_delay 0.25
 set g_cts_selfdamage 1 "0 = disable all selfdamage and falldamage in cts"
+set g_cts_finish_kill_delay 10 "prevent cheating by running back to the start line, and starting out with more speed than otherwise possible"
 
 // overtime
 seta timelimit_overtime 2 "duration in minutes of one added overtime, added to the timelimit"
@@ -1657,6 +1658,7 @@ set g_showweaponspawns 1  "display sprites for weapon spawns found on the map whe
 
 alias records "cmd records"
 alias rankings "cmd rankings"
+alias ladder "cmd ladder"
 
 // ballistics use physical units, but qu based
 //   Quake-Newton: 1 qN  = 1 qu * 1 g / 1 s^2
@@ -2001,3 +2003,18 @@ r_font_size_snapping 2
 // database management
 set sv_db_saveasdump 0 "write server.db in dump format (loads slower, easier to read/parse)"
 set cl_db_saveasdump 0 "write client.db in dump format (loads slower, easier to read/parse)"
+
+// uid2name
+seta cl_allow_uid2name -1 "-1 = ask if the player wants to disable/enable this feature, 0 = disable, 1 = enable uid2name (allows showing your name in race rankings for instance)"
+
+// polygonoffset for submodel SUCKS SUCKS SUCKS (only a hack for quake1, we don't need that)
+r_polygonoffset_submodel_offset 0
+r_polygonoffset_submodel_factor 0
+// workaround for "decals flicker all the time" - note that this polygonoffset still is not perfect, also, why do decals need higher polygonoffset when in a warpzone
+// this workaround causes decals to sometimes be visible through walls! (not seen it happen yet though other than on zfightometer)
+// once the issue is found, please revert back to the default of -14
+r_polygonoffset_decals_offset -100
+r_polygonoffset_decals_factor 0
+// this is mainly for _decal entities (their shaders should use "polygonoffset" shader parameter) - this is "good enough" as it seems, but smaller than the decals one so these don't zfight decals
+mod_q3shader_default_polygonoffset -50
+mod_q3shader_default_polygonfactor 0
index b0f7b3dd7ca0390e04481a6a30d5977c8824266a..3ad766d85ff714ded5623b3f1ef287583faa6dbb 100644 (file)
@@ -4983,7 +4983,7 @@ size 16 16
 alpha 256 256 0
 originjitter 2 2 2
 lightradius 50
-lightradiusfade 200
+lightradiusfade 500
 lightcolor 3.125 4.375 10
 effect electro_lightning
 count 300
index f1e92735a1a3ccbf89702b8dc97b3877890324b7..7103e55b7468141f943d223d05c321cea593092e 100644 (file)
Binary files a/gfx/menu/default/icon_aeslevel1.tga and b/gfx/menu/default/icon_aeslevel1.tga differ
index 7153820cd52c84b153d486e868b239f2508e678f..793b457692829f61f01c791b2010ffcc3a9a6a29 100644 (file)
Binary files a/gfx/menu/default/icon_aeslevel2.tga and b/gfx/menu/default/icon_aeslevel2.tga differ
index c31bfe802e988d94d72b84ceeae36a4fb5ef9d3c..ec2f15bf2f056f3b9f8411224cfcd0837f2e2028 100644 (file)
Binary files a/gfx/menu/default/icon_aeslevel3.tga and b/gfx/menu/default/icon_aeslevel3.tga differ
index 88963f8d840f66bb06b9fcb7a7c378e124a4e238..8f7f4669b81f01adaa6c41e42ca9d3f92abd4032 100644 (file)
Binary files a/gfx/menu/default/icon_aeslevel4.tga and b/gfx/menu/default/icon_aeslevel4.tga differ
index 0ed332d8ac546d2880554d9915076650c6b55d84..8662b137b6c3d72ea0422fdc46181e25bcc82a22 100644 (file)
Binary files a/gfx/menu/default/icon_aeslevel5.tga and b/gfx/menu/default/icon_aeslevel5.tga differ
index f1e92735a1a3ccbf89702b8dc97b3877890324b7..7103e55b7468141f943d223d05c321cea593092e 100644 (file)
Binary files a/gfx/menu/luminos/icon_aeslevel1.tga and b/gfx/menu/luminos/icon_aeslevel1.tga differ
index 7153820cd52c84b153d486e868b239f2508e678f..793b457692829f61f01c791b2010ffcc3a9a6a29 100644 (file)
Binary files a/gfx/menu/luminos/icon_aeslevel2.tga and b/gfx/menu/luminos/icon_aeslevel2.tga differ
index c31bfe802e988d94d72b84ceeae36a4fb5ef9d3c..ec2f15bf2f056f3b9f8411224cfcd0837f2e2028 100644 (file)
Binary files a/gfx/menu/luminos/icon_aeslevel3.tga and b/gfx/menu/luminos/icon_aeslevel3.tga differ
index 88963f8d840f66bb06b9fcb7a7c378e124a4e238..8f7f4669b81f01adaa6c41e42ca9d3f92abd4032 100644 (file)
Binary files a/gfx/menu/luminos/icon_aeslevel4.tga and b/gfx/menu/luminos/icon_aeslevel4.tga differ
index 0ed332d8ac546d2880554d9915076650c6b55d84..8662b137b6c3d72ea0422fdc46181e25bcc82a22 100644 (file)
Binary files a/gfx/menu/luminos/icon_aeslevel5.tga and b/gfx/menu/luminos/icon_aeslevel5.tga differ
index f1e92735a1a3ccbf89702b8dc97b3877890324b7..7103e55b7468141f943d223d05c321cea593092e 100644 (file)
Binary files a/gfx/menu/xaw/icon_aeslevel1.tga and b/gfx/menu/xaw/icon_aeslevel1.tga differ
index 7153820cd52c84b153d486e868b239f2508e678f..793b457692829f61f01c791b2010ffcc3a9a6a29 100644 (file)
Binary files a/gfx/menu/xaw/icon_aeslevel2.tga and b/gfx/menu/xaw/icon_aeslevel2.tga differ
index c31bfe802e988d94d72b84ceeae36a4fb5ef9d3c..ec2f15bf2f056f3b9f8411224cfcd0837f2e2028 100644 (file)
Binary files a/gfx/menu/xaw/icon_aeslevel3.tga and b/gfx/menu/xaw/icon_aeslevel3.tga differ
index 88963f8d840f66bb06b9fcb7a7c378e124a4e238..8f7f4669b81f01adaa6c41e42ca9d3f92abd4032 100644 (file)
Binary files a/gfx/menu/xaw/icon_aeslevel4.tga and b/gfx/menu/xaw/icon_aeslevel4.tga differ
index 0ed332d8ac546d2880554d9915076650c6b55d84..8662b137b6c3d72ea0422fdc46181e25bcc82a22 100644 (file)
Binary files a/gfx/menu/xaw/icon_aeslevel5.tga and b/gfx/menu/xaw/icon_aeslevel5.tga differ
index 9c50d7a3442d7fd36585ad836d26ced8ea07f6e6..4846a9fef572aab667fafb724778051d7c69f78c 100644 (file)
@@ -627,6 +627,56 @@ float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
        local float bSkipKey;
        bSkipKey = false;
 
+       if(autocvar_cl_allow_uid2name == -1 && (gametype == GAME_CTS || gametype == GAME_RACE) && panel_fg_alpha && !scoreboard_active) // don't lock keys before we actually see what's going on
+       {
+               /*
+               string vyes_keys;
+               float keys;
+               vyes_keys = findkeysforcommand("vyes");
+               keys = tokenize(vyes_keys);
+
+               float i;
+               for (i = 0; i < keys; ++i)
+               {
+                       print(ftos(nPrimary), " ", argv(i), "\n"); 
+                       if(nPrimary == stof(argv(i)))
+                       {
+                               vote_active = 0;
+                               cvar_set("cl_allow_uid2name", "1");
+                               return TRUE;
+                       }
+               }
+
+               string vno_keys;
+               vno_keys = findkeysforcommand("vno");
+               keys = tokenize(vno_keys);
+
+               float i;
+               for (i = 0; i < keys; ++i)
+               {
+                       if(nPrimary == stof(argv(i)))
+                       {
+                               vote_active = 0;
+                               cvar_set("cl_allow_uid2name", "0");
+                               return TRUE;
+                       }
+               }
+               */ // If only I could grab F1-F12 in CSQC... but no
+
+               if(nPrimary == 121) // ascii value for y
+               {
+                       vote_active = 0;
+                       cvar_set("cl_allow_uid2name", "1");
+                       return TRUE;
+               }
+               else if(nPrimary == 110) // ascii value for n
+               {
+                       vote_active = 0;
+                       cvar_set("cl_allow_uid2name", "0");
+                       return TRUE;
+               }
+       }
+
        if (HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary))
                return true;
 
@@ -636,6 +686,7 @@ float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
        if(menu_visible)
                if(menu_action(bInputType, nPrimary, nSecondary))
                        return TRUE;
+
        return bSkipKey;
 }
 
index ac721eda1a5e9456f2b585cdc50ee723f3f3219a..ea0fcecedfa8ac2a716fe6c23f9012f07093571d 100644 (file)
@@ -235,3 +235,5 @@ var string autocvar_hud_panel_infomessages_bg_padding;
 var float autocvar_hud_panel_infomessages_flip;
 
 var float autocvar_scoreboard_border_thickness;
+
+var float autocvar_cl_allow_uid2name;
index 379b81075133ad76755665608b73b7341d15abab..971a791aad847ac58625919380c4b6e81412cba9 100644 (file)
@@ -2595,6 +2595,9 @@ void HUD_KillNotify(string s1, string s2, string s3, float type, float msg) // s
        alsoprint = (autocvar_hud_panel_notify_print || !panel_enabled); // print message to console if: notify panel disabled, or cvar to do so enabled
        gentle = (autocvar_cl_gentle || autocvar_cl_gentle_messages);
        
+       if ((msg == MSG_SUICIDE || msg == MSG_KILL || msg == MSG_KILL_ACTION) && gametype == GAME_CTS) // selfkill isn't interesting in CTS and only spams up the notify panel
+               return;
+
        if(msg == MSG_SUICIDE) {
                w = DEATH_WEAPONOF(type);
                if(WEP_VALID(w)) {
@@ -2921,6 +2924,19 @@ void HUD_KillNotify(string s1, string s2, string s3, float type, float msg) // s
                        HUD_KillNotify_Push(s1, s2, 0, INFO_CAPTUREFLAG);
                        print(s1, "^7 captured the ", s2, s3, "\n");
                }
+       } else if(msg == MSG_RACE) {
+               if(type == RACE_SERVER_RECORD) {
+                       HUD_KillNotify_Push(s1, s2, 1, RACE_SERVER_RECORD);
+               }
+               else if(type == RACE_NEW_RANK) {
+                       HUD_KillNotify_Push(s1, s2, 1, RACE_NEW_RANK);
+               }
+               else if(type == RACE_NEW_TIME) {
+                       HUD_KillNotify_Push(s1, s2, 1, RACE_NEW_TIME);
+               }
+               else if(type == RACE_FAIL) {
+                       HUD_KillNotify_Push(s1, s2, 1, RACE_FAIL);
+               }
        }
 }
 
@@ -3257,6 +3273,22 @@ void HUD_Notify (void)
                        {
                                s = "notify_void";
                        }
+                       else if(killnotify_deathtype[j] == RACE_SERVER_RECORD)
+                       {
+                               s = "race_newrecordserver";
+                       }
+                       else if(killnotify_deathtype[j] == RACE_NEW_RANK)
+                       {
+                               s = "race_newrankyellow";
+                       }
+                       else if(killnotify_deathtype[j] == RACE_NEW_TIME)
+                       {
+                               s = "race_newtime";
+                       }
+                       else if(killnotify_deathtype[j] == RACE_FAIL)
+                       {
+                               s = "race_newfail";
+                       }
                        if(s != "" && a)
                        {
                                drawpic_aspect_skin(weap_pos, s, '2 1 0' * height, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
@@ -3485,6 +3517,7 @@ void HUD_Score(void)
        }
 
        float score, distribution, leader;
+       string sign;
        vector distribution_color;
        entity tm, pl, me;
        me = (spectatee_status > 0) ? playerslots[spectatee_status - 1] : playerslots[player_localentnum - 1];
@@ -3506,15 +3539,17 @@ void HUD_Score(void)
                        // distribution display
                        distribution = me.(scores[ps_primary]) - pl.(scores[ps_primary]);
 
-                       distrtimer = ftos(distribution/pow(10, TIME_DECIMALS));
+                       distrtimer = ftos_decimals(fabs(distribution/pow(10, TIME_DECIMALS)), TIME_DECIMALS);
 
                        if (distribution <= 0) {
                                distribution_color = '0 1 0';
+                               sign = "-";
                        }
                        else {
                                distribution_color = '1 0 0';
+                               sign = "+";
                        }
-                       drawstring_aspect(pos + eX * 0.75 * mySize_x, distrtimer, eX * 0.25 * mySize_x + eY * (1/3) * mySize_y, distribution_color, panel_fg_alpha, DRAWFLAG_NORMAL);
+                       drawstring_aspect(pos + eX * 0.75 * mySize_x, strcat(sign, distrtimer), eX * 0.25 * mySize_x + eY * (1/3) * mySize_y, distribution_color, panel_fg_alpha, DRAWFLAG_NORMAL);
                }
                // race record display
                if (distribution <= 0)
@@ -3747,11 +3782,22 @@ float vote_change; // "time" when vote_active changed
 
 void HUD_VoteWindow(void) 
 {
+       if(autocvar_cl_allow_uid2name == -1 && (gametype == GAME_CTS || gametype == GAME_RACE))
+       {
+               vote_active = 1;
+               vote_called_vote = strzone(strcat("^2Name ^7instead of \"^1Unregistered player\"", " ^7in stats"));
+       }
+
        if(!autocvar_hud_panel_vote && !autocvar__hud_configure)
                return;
 
        active_panel = HUD_PANEL_VOTE;
        HUD_Panel_UpdateCvars(vote);
+       if(autocvar_cl_allow_uid2name == -1 && (gametype == GAME_CTS || gametype == GAME_RACE))
+       {
+               panel_pos = eX * 0.3 * vid_conwidth + eY * 0.1 * vid_conheight;
+               panel_size = eX * 0.4 * vid_conwidth + eY * 0.3 * vid_conheight;
+       }
        vector pos, mySize;
        pos = panel_pos;
        mySize = panel_size;
@@ -3817,16 +3863,22 @@ void HUD_VoteWindow(void)
        mySize = newSize;
 
        s = "A vote has been called for:";
+       if(autocvar_cl_allow_uid2name == -1 && (gametype == GAME_CTS || gametype == GAME_RACE))
+               s = "Allow servers to store and display your name?";
        drawstring_aspect(pos, s, eX * mySize_x + eY * (2/8) * mySize_y, '1 1 1', a, DRAWFLAG_NORMAL);
-       s = textShortenToWidth(vote_called_vote, mySize_x, '1 1 0' * mySize_y * (1.75/8), stringwidth_colors);
+       s = textShortenToWidth(vote_called_vote, mySize_x, '1 1 0' * mySize_y * (1/8), stringwidth_colors);
        if(autocvar__hud_configure)
                s = "^1Configure the HUD";
        drawcolorcodedstring_aspect(pos + eY * (2/8) * mySize_y, s, eX * mySize_x + eY * (1.75/8) * mySize_y, a, DRAWFLAG_NORMAL);
 
        // print the yes/no counts
        s = strcat("Yes (", getcommandkey("vyes", "vyes"), "): ", ftos(vote_yescount));
+       if(autocvar_cl_allow_uid2name == -1 && (gametype == GAME_CTS || gametype == GAME_RACE))
+               s = strcat("Yes: (press y)");
        drawstring_aspect(pos + eY * (4/8) * mySize_y, s, eX * 0.5 * mySize_x + eY * (1.5/8) * mySize_y, '0 1 0', a, DRAWFLAG_NORMAL);
        s = strcat("No (", getcommandkey("vno", "vno"), "): ", ftos(vote_nocount));
+       if(autocvar_cl_allow_uid2name == -1 && (gametype == GAME_CTS || gametype == GAME_RACE))
+               s = strcat("No: (press n)");
        drawstring_aspect(pos + eX * 0.5 * mySize_x + eY * (4/8) * mySize_y, s, eX * 0.5 * mySize_x + eY * (1.5/8) * mySize_y, '1 0 0', a, DRAWFLAG_NORMAL);
 
        // draw the progress bar backgrounds
index 2fdf0d22034b2cd9f9f285db4686c9acbda31531..b61568a2aeeb9c18ae9f2a16fd14d1892c4be305 100644 (file)
@@ -1043,7 +1043,7 @@ vector HUD_DrawScoreboardRankings(vector pos, entity pl,  vector rgb, vector bg_
        pos_y += hud_fontsize_y;
        vector tmp;
        tmp_x = sbwidth;
-       tmp_y = hud_fontsize_y * RANKINGS_RECEIVED_CNT;
+       tmp_y = 1.25 * hud_fontsize_y * RANKINGS_RECEIVED_CNT;
 
        if (teamplay)
                drawpic_tiled(pos, "gfx/scoreboard/scoreboard_bg", bg_size, tmp, rgb * autocvar_scoreboard_color_bg_team, scoreboard_alpha_bg, DRAWFLAG_NORMAL);
@@ -1062,12 +1062,12 @@ vector HUD_DrawScoreboardRankings(vector pos, entity pl,  vector rgb, vector bg_
                n = grecordholder[i];
                p = race_PlaceName(i+1);
                if(grecordholder[i] == GetPlayerName(player_localentnum - 1))
-                       drawfill(pos, '1 0 0' * sbwidth + '0 1 0' * hud_fontsize_y, hl_rgb, scoreboard_highlight_alpha_self, DRAWFLAG_NORMAL);
+                       drawfill(pos, '1 0 0' * sbwidth + '0 1.25 0' * hud_fontsize_y, hl_rgb, scoreboard_highlight_alpha_self, DRAWFLAG_NORMAL);
                else if(!mod(i, 2) && scoreboard_highlight)
-                       drawfill(pos, '1 0 0' * sbwidth + '0 1 0' * hud_fontsize_y, hl_rgb, scoreboard_highlight_alpha, DRAWFLAG_NORMAL);
-               drawstring(pos, p, hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
-               drawstring(pos + '3 0 0' * hud_fontsize_x, TIME_ENCODED_TOSTRING(t), hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
-               drawcolorcodedstring(pos + '8 0 0' * hud_fontsize_x, n, hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
+                       drawfill(pos, '1 0 0' * sbwidth + '0 1.25 0' * hud_fontsize_y, hl_rgb, scoreboard_highlight_alpha, DRAWFLAG_NORMAL);
+               drawstring(pos, p, '1 1 0' * hud_fontsize_y, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
+               drawstring(pos + '3 0 0' * hud_fontsize_y, TIME_ENCODED_TOSTRING(t), '1 1 0' * hud_fontsize_y, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
+               drawcolorcodedstring(pos + '8 0 0' * hud_fontsize_y, n, '1 1 0' * hud_fontsize_y, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
                pos_y += 1.25 * hud_fontsize_y;
        }
 
@@ -1176,11 +1176,11 @@ void HUD_DrawScoreboard()
 
        if(gametype == GAME_CTS || gametype == GAME_RACE) {
                if(race_speedaward) {
-                       drawcolorcodedstring(pos, strcat("Speed award: ", ftos(race_speedaward), " (", race_speedaward_holder, ")"), hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
+                       drawcolorcodedstring(pos, strcat("Speed award: ", ftos(race_speedaward), " ^7(", race_speedaward_holder, "^7)"), hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
                        pos_y += 1.25 * hud_fontsize_y;
                }
                if(race_speedaward_alltimebest) {
-                       drawcolorcodedstring(pos, strcat("All-time fastest: ", ftos(race_speedaward_alltimebest), " (", race_speedaward_alltimebest_holder, ")"), hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
+                       drawcolorcodedstring(pos, strcat("All-time fastest: ", ftos(race_speedaward_alltimebest), " ^7(", race_speedaward_alltimebest_holder, "^7)"), hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
                        pos_y += 1.25 * hud_fontsize_y;
                }
                pos = HUD_DrawScoreboardRankings(pos, pl, rgb, bg_size);
index 36ea68ddd87db7eac868dbcafb68fc3b04e1f328..29029f6e457562aa1a6427d7ff131b5a8d229a98 100644 (file)
@@ -565,6 +565,8 @@ float MSG_KILL_ACTION = 3;
 float MSG_KILL_ACTION_SPREE = 4;
 float MSG_INFO = 5;
 
+float MSG_RACE = 10;
+
 float KILL_TEAM_RED = 10301;
 float KILL_TEAM_BLUE = 10302;
 float KILL_TEAM_SPREE = 10303;
@@ -590,6 +592,11 @@ float INFO_LOSTFLAG = 10321;
 float INFO_RETURNFLAG = 10322;
 float INFO_CAPTUREFLAG = 10323;
 
+float RACE_SERVER_RECORD = 10400;
+float RACE_NEW_TIME = 10401;
+float RACE_NEW_RANK = 10402;
+float RACE_FAIL = 10403;
+
 // weapon requests
 float WR_SETUP         = 1; // (SVQC) setup weapon data
 float WR_THINK         = 2; // (SVQC) logic to run every frame
index be2f5e78c202bfed5398a7260041bfea1bb7cfda..f6b54f155b842e6ff683ad236bfb7463f8d785ae 100644 (file)
@@ -831,6 +831,10 @@ float GameCommand_Generic(string command)
                print(records_reply);
                return TRUE;
        }
+       else if(argv(0) == "ladder") {
+               print(ladder_reply);
+               return TRUE;
+       }
        else if(argv(0) == "rankings") {
                print(rankings_reply);
                return TRUE;
index 33889827e36deebad5975fc15b7cc171b79ff708..5192b75ac24ea37fd4a67cc72bc885b80dd3ea60 100644 (file)
@@ -907,6 +907,7 @@ float MapInfo_Get_ByName(string pFilename, float pAllowGenerate, float pGametype
                {
                        t = car(s); s = cdr(s);
                        if     (t == "weapons") MapInfo_Map_supportedFeatures |= MAPINFO_FEATURE_WEAPONS;
+                       else if(t == "new_toys") MapInfo_Map_supportedFeatures |= MAPINFO_FEATURE_WEAPONS;
                        else
                                dprint("Map ", pFilename, " supports unknown feature ", t, ", ignored\n");
                }
@@ -1029,8 +1030,9 @@ float MapInfo_Get_ByName(string pFilename, float pAllowGenerate, float pGametype
        {
                if(!(MapInfo_Map_supportedGametypes & pGametypeToSet))
                {
-                       print("Can't select the requested game type. Trying anyway with stupid settings.\n");
-                       _MapInfo_Map_ApplyGametypeEx("", pGametypeToSet, MAPINFO_TYPE_DEATHMATCH);
+                       error("Can't select the requested game type. This should never happen as the caller should prevent it!\n");
+                       //_MapInfo_Map_ApplyGametypeEx("", pGametypeToSet, MAPINFO_TYPE_DEATHMATCH);
+                       //return;
                }
        }
 
@@ -1232,6 +1234,8 @@ void MapInfo_LoadMapSettings(string s) // to be called from worldspawn
                {
                        print("Mapinfo system is not functional at all. Assuming deathmatch.\n");
                        MapInfo_Map_supportedGametypes = MAPINFO_TYPE_DEATHMATCH;
+                       _MapInfo_Map_ApplyGametypeEx("", t0, t0);
+                       return; // do not call Get_ByName!
                }
 
                t = 1;
@@ -1245,12 +1249,9 @@ void MapInfo_LoadMapSettings(string s) // to be called from worldspawn
                if(cvar("g_mapinfo_allow_unsupported_modes_and_let_stuff_break"))
                {
                        print("EMERGENCY: can't play the selected map in the given game mode. Working with only the override settings.\n");
-                       cvar_set("timelimit", "0");
-                       cvar_set("fraglimit", "0");
-                       cvar_set("g_tdm_teams", "2");
-                       cvar_set("g_keyhunt_teams", "3");
-                       cvar_set("g_race_qualifying_timelimit", "0");
-                       cvar_set("leadlimit", "0");
+                       cvar_settemp_restore();
+                       _MapInfo_Map_ApplyGametypeEx("", t0, t0);
+                       return; // do not call Get_ByName!
                }
                else
                {
index 4e6ac985517df071103f4ea3e70c0d1d53c2229d..1fcc0dc662783ebd056281a5732a9d75ca98a31f 100644 (file)
@@ -1,18 +1,18 @@
-float MAPINFO_TYPE_CTF                         = 1;
-float MAPINFO_TYPE_ASSAULT                     = 2;
-float MAPINFO_TYPE_ONSLAUGHT           = 4;
-float MAPINFO_TYPE_RACE                                = 8;
-float MAPINFO_TYPE_DEATHMATCH          = 16;
-float MAPINFO_TYPE_TEAM_DEATHMATCH     = 32;
-float MAPINFO_TYPE_DOMINATION          = 64;
-float MAPINFO_TYPE_RUNEMATCH           = 128;
-float MAPINFO_TYPE_LMS                         = 256;
-float MAPINFO_TYPE_ARENA                       = 512;
-float MAPINFO_TYPE_KEYHUNT                     = 1024;
-float MAPINFO_TYPE_NEXBALL          = 2048;
-float MAPINFO_TYPE_CTS              = 4096;
-float MAPINFO_TYPE_CA                          = 8192;
-float MAPINFO_TYPE_ALL              = 16383; // this has to include all above bits
+float MAPINFO_TYPE_DEATHMATCH          = 1;
+float MAPINFO_TYPE_LMS                 = 2;
+float MAPINFO_TYPE_ARENA               = 4;
+float MAPINFO_TYPE_RUNEMATCH           = 8;
+float MAPINFO_TYPE_RACE                        = 16;
+float MAPINFO_TYPE_CTS                 = 32;
+float MAPINFO_TYPE_TEAM_DEATHMATCH     = 64;
+float MAPINFO_TYPE_CTF                 = 128;
+float MAPINFO_TYPE_CA                  = 256;
+float MAPINFO_TYPE_DOMINATION          = 512;
+float MAPINFO_TYPE_KEYHUNT             = 1024;
+float MAPINFO_TYPE_ASSAULT             = 2048;
+float MAPINFO_TYPE_ONSLAUGHT           = 4096;
+float MAPINFO_TYPE_NEXBALL             = 8192;
+float MAPINFO_TYPE_ALL                 = 16383; // this has to include all above bits
 
 float MAPINFO_FEATURE_WEAPONS       = 1; // not defined for minstagib-only maps
 
index f1d283238bf7590ab399aa7a75a2a34ab89755a9..2de439ff2732a7775d9670b98e4ce3bd49d11fb2 100644 (file)
@@ -165,7 +165,7 @@ void check_unacceptable_compiler_bugs();
 float compressShotOrigin(vector v);
 vector decompressShotOrigin(float f);
 
-string rankings_reply, lsmaps_reply, lsnewmaps_reply, maplist_reply; // cached replies
+string rankings_reply, ladder_reply, lsmaps_reply, lsnewmaps_reply, maplist_reply; // cached replies
 string records_reply[10];
 
 float RandomSelection_totalweight;
index 4824331a0305dab6fe3a7d2a7a6c48cf36b917cb..5f6262cf45e5bdb508f69dd32f7117cd4b9c673e 100644 (file)
@@ -21,7 +21,6 @@ CLASS(XonoticServerInfoDialog) EXTENDS(XonoticDialog)
        ATTRIB(XonoticServerInfoDialog, currentServerKey, string, string_null)
        ATTRIB(XonoticServerInfoDialog, currentServerID, string, string_null)
        ATTRIB(XonoticServerInfoDialog, currentServerEncrypt, string, string_null)
-       ATTRIB(XonoticServerInfoDialog, currentServerCanConnect, string, string_null)
        ATTRIB(XonoticServerInfoDialog, currentServerPure, string, string_null)
 
        ATTRIB(XonoticServerInfoDialog, nameLabel, entity, NULL)
@@ -60,6 +59,50 @@ void XonoticServerInfoDialog_loadServerInfo(entity me, float i)
        float m, pure, j;
        string s, typestr, versionstr, numh, maxp, k, v;
 
+       if(me.currentServerName)
+               strunzone(me.currentServerName);
+       me.currentServerName = string_null;
+       if(me.currentServerCName)
+               strunzone(me.currentServerCName);
+       me.currentServerCName = string_null;
+       if(me.currentServerType)
+               strunzone(me.currentServerType);
+       me.currentServerType = string_null;
+       if(me.currentServerMap)
+               strunzone(me.currentServerMap);
+       me.currentServerMap = string_null;
+       if(me.currentServerPlayers)
+               strunzone(me.currentServerPlayers);
+       me.currentServerPlayers = string_null;
+       if(me.currentServerNumPlayers)
+               strunzone(me.currentServerNumPlayers);
+       me.currentServerNumPlayers = string_null;
+       if(me.currentServerNumBots)
+               strunzone(me.currentServerNumBots);
+       me.currentServerNumBots = string_null;
+       if(me.currentServerMod)
+               strunzone(me.currentServerMod);
+       me.currentServerMod = string_null;
+       if(me.currentServerVersion)
+               strunzone(me.currentServerVersion);
+       me.currentServerVersion = string_null;
+       if(me.currentServerPing)
+               strunzone(me.currentServerPing);
+       me.currentServerPing = string_null;
+       if(me.currentServerKey)
+               strunzone(me.currentServerKey);
+       me.currentServerKey = string_null;
+       if(me.currentServerID)
+               strunzone(me.currentServerID);
+       me.currentServerID = string_null;
+       // not zoned!
+       //if(me.currentServerEncrypt)
+       //      strunzone(me.currentServerEncrypt);
+       //me.currentServerEncrypt = string_null;
+       if(me.currentServerPure)
+               strunzone(me.currentServerPure);
+       me.currentServerPure = string_null;
+
        SLIST_FIELD_NAME = gethostcacheindexforkey("name");
        me.currentServerName = strzone(gethostcachestring(SLIST_FIELD_NAME, i));
        me.nameLabel.setText(me.nameLabel, me.currentServerName);
@@ -121,6 +164,7 @@ void XonoticServerInfoDialog_loadServerInfo(entity me, float i)
        me.versionLabel.setText(me.versionLabel, me.currentServerVersion);
 
        me.currentServerPure = ((pure < 0) ? "N/A" : (pure == 0) ? "Official settings" : sprintf("%d modified settings", pure));
+       me.currentServerPure = strzone(me.currentServerPure);
        me.pureLabel.setText(me.pureLabel, me.currentServerPure);
 
        SLIST_FIELD_PING = gethostcacheindexforkey("ping");
@@ -128,8 +172,6 @@ void XonoticServerInfoDialog_loadServerInfo(entity me, float i)
        me.currentServerPing = strzone(s);
        me.pingLabel.setText(me.pingLabel, me.currentServerPing);
 
-       print(me.currentServerCName, "\n");
-
        s = crypto_getidfp(me.currentServerCName);
        if not(s)
                s = "N/A";
@@ -156,19 +198,25 @@ void XonoticServerInfoDialog_loadServerInfo(entity me, float i)
                        if(cvar("crypto_aeslevel") >= 3)
                                me.currentServerEncrypt = "not supported (can't connect)";
                        else
-                               me.currentServerEncrypt = "not supported";
+                               me.currentServerEncrypt = "not supported (won't encrypt)";
                        break;
                case 1:
-                       me.currentServerEncrypt = "supported";
+                       if(cvar("crypto_aeslevel") >= 2)
+                               me.currentServerEncrypt = "supported (will encrypt)";
+                       else
+                               me.currentServerEncrypt = "supported (won't encrypt)";
                        break;
                case 2:
-                       me.currentServerEncrypt = "requested";
+                       if(cvar("crypto_aeslevel") >= 1)
+                               me.currentServerEncrypt = "requested (will encrypt)";
+                       else
+                               me.currentServerEncrypt = "requested (won't encrypt)";
                        break;
                case 3:
                        if(cvar("crypto_aeslevel") <= 0)
                                me.currentServerEncrypt = "required (can't connect)";
                        else
-                               me.currentServerEncrypt = "required";
+                               me.currentServerEncrypt = "required (will encrypt)";
                        break;
        }
        me.encryptLabel.setText(me.encryptLabel, me.currentServerEncrypt);
index f409a1b99df2742445a88bd1cfe1ea3b5f63ce2b..b3a658e3bd5732850058723633eb3ce8b12259a2 100644 (file)
@@ -36,8 +36,6 @@ entity makeXonoticPlayerList()
 
 void XonoticPlayerList_setPlayerList(entity me, string plist)
 {
-       dprint(plist,"------------\n");
-
        float buf,i,n;
        string s;
 
index bd2acdf5a60ea0e20718ea363b9c9ee1d905a2bc..aa47110bee63eeec644582a2b99e8b356d955d15 100644 (file)
@@ -36,10 +36,7 @@ void XonoticWeaponsList_draw(entity me)
        s = W_NumberWeaponOrder(cvar_string("cl_weaponpriority"));
        t = W_FixWeaponOrder(s, 1);
        if(t != s)
-       {
-               print("AUTOFIXED\n");
                cvar_set("cl_weaponpriority", W_NameWeaponOrder(t));
-       }
        me.nItems = tokenize_console(t);
        SUPER(XonoticWeaponsList).draw(me);
 }
index b03723ae45b78745a353f5919a0da35020e31eeb..66a838a31cfa0e2ebdfb8aee4ccad1a6e197bc68 100644 (file)
@@ -1313,6 +1313,22 @@ void ClientKill (void)
                ClientKill_TeamChange(0);
 }
 
+void CTS_ClientKill_Think (void)
+{
+       self = self.owner; // set self to the player to be killed
+       sprint(self, "^1You were killed in order to prevent cheating!");
+       ClientKill_Now();
+}
+
+void CTS_ClientKill (float t) // silent version of ClientKill
+{
+       entity e;
+       e = spawn();
+       e.owner = self;
+       e.think = CTS_ClientKill_Think;
+       e.nextthink = t;
+}
+
 void DoTeamChange(float destteam)
 {
        float t, c0;
@@ -1587,11 +1603,12 @@ void ClientConnect (void)
                        rr = RACE_RECORD;
                t = stof(db_get(ServerProgsDB, strcat(GetMapname(), rr, "time")));
 
+               msg_entity = self;
                race_send_recordtime(MSG_ONE);
                race_send_speedaward(MSG_ONE);
 
                speedaward_alltimebest = stof(db_get(ServerProgsDB, strcat(GetMapname(), rr, "speed/speed")));
-               speedaward_alltimebest_holder = db_get(ServerProgsDB, strcat(GetMapname(), rr, "speed/netname"));
+               speedaward_alltimebest_holder = uid2name(db_get(ServerProgsDB, strcat(GetMapname(), rr, "speed/crypto_idfp")));
                race_send_speedaward_alltimebest(MSG_ONE);
 
                float i;
@@ -3017,6 +3034,18 @@ void PlayerPostThink (void)
 
        playerdemo_write();
 
+       if((g_cts || g_race) && self.cvar_cl_allow_uid2name)
+       {
+               if(!self.stored_netname)
+                       self.stored_netname = strzone(uid2name(self.crypto_idfp));
+               if(self.stored_netname != self.netname)
+               {
+                       db_put(ServerProgsDB, strcat("uid2name", self.crypto_idfp), self.netname);
+                       strunzone(self.stored_netname);
+                       self.stored_netname = strzone(self.netname);
+               }
+       }
+
        /*
        if(g_race)
                dprint(sprintf("%f %.6f\n", time, race_GetFractionalLapCount(self)));
index 440c69bf33c13b4ab75f42a4320d543c9c7580f2..e211275b0f3eb4f7d1af694562ada31beabe39ae 100644 (file)
@@ -671,6 +671,7 @@ void SpecialCommand()
 
 float speedaward_speed;
 string speedaward_holder;
+string speedaward_uid;
 void race_send_speedaward(float msg)
 {
        // send the best speed of the round
@@ -683,6 +684,7 @@ void race_send_speedaward(float msg)
 
 float speedaward_alltimebest;
 string speedaward_alltimebest_holder;
+string speedaward_alltimebest_uid;
 void race_send_speedaward_alltimebest(float msg)
 {
        // send the best speed
@@ -1304,6 +1306,7 @@ void SV_PlayerPhysics()
                if(vlen(self.velocity - self.velocity_z * '0 0 1') > speedaward_speed) {
                        speedaward_speed = vlen(self.velocity - self.velocity_z * '0 0 1');
                        speedaward_holder = self.netname;
+                       speedaward_uid = self.crypto_idfp;
                        speedaward_lastupdate = time;
                }
                if(speedaward_speed > speedaward_lastsent && time - speedaward_lastupdate > 1) {
@@ -1317,8 +1320,9 @@ void SV_PlayerPhysics()
                        if (speedaward_speed > speedaward_alltimebest) {
                                speedaward_alltimebest = speedaward_speed;
                                speedaward_alltimebest_holder = speedaward_holder;
+                               speedaward_alltimebest_uid = speedaward_uid;
                                db_put(ServerProgsDB, strcat(GetMapname(), rr, "speed/speed"), ftos(speedaward_alltimebest));
-                               db_put(ServerProgsDB, strcat(GetMapname(), rr, "speed/netname"), speedaward_alltimebest_holder);
+                               db_put(ServerProgsDB, strcat(GetMapname(), rr, "speed/crypto_idfp"), speedaward_alltimebest_uid);
                                race_send_speedaward_alltimebest(MSG_ALL);
                        }
                }
index 0216757e9ccc99e358195b5f0426d1ab67ff6620..df19ab592f4779beb94a38881992e37150a43ae0 100644 (file)
@@ -303,6 +303,8 @@ void SV_ParseClientCommand(string s) {
        } else if(cmd == "records") {
                for(i = 0; i < 10; ++i)
                        sprint(self, records_reply[i]);
+       } else if(cmd == "ladder") {
+               sprint(self, ladder_reply);
        } else if(cmd == "rankings") {
                sprint(self, rankings_reply);
        } else if(cmd == "voice") {
index ecca4ac431250e1aba349da70b3d5a02dc7ba988..45394eb7925db2bf34fd5e10818131e5646af2dc 100644 (file)
@@ -329,6 +329,9 @@ float sv_loddistance2;
 
 .string weaponorder_byimpulse;
 
+.float cvar_cl_allow_uid2name;
+.string stored_netname;
+
 void Announce(string snd);
 void AnnounceTo(entity e, string snd);
 
index a6e73ba251b1132e343ab39ffac5bf21a1f81563..f5def6a7dd68e4dd9660d62f4a1d7811372509bc 100644 (file)
@@ -13,6 +13,9 @@ float Violence_GibSplash_SendEntity(entity to, float sf)
 // TODO maybe convert this to a TE?
 void Violence_GibSplash_At(vector org, vector dir, float type, float amount, entity gibowner, entity attacker)
 {
+       if(g_cts) // no gibs in CTS
+               return;
+
        entity e;
 
        e = spawn();
index b4bb3100a228bad5cf48c31ca70b674ef6b85c03..b351d77615732eb249be7c7c775c3bdbb017ceba 100644 (file)
@@ -304,6 +304,12 @@ void cvar_changes_init()
                // mapinfo
                BADCVAR("timelimit");
                BADCVAR("fraglimit");
+               BADCVAR("leadlimit");
+               BADCVAR("g_tdm_teams");
+               BADCVAR("g_keyhunt_teams");
+               BADCVAR("g_domination_default_teams");
+               BADCVAR("g_race_qualifying_timelimit");
+               BADCVAR("g_lms");
                BADCVAR("g_arena");
                BADCVAR("g_ca");
                BADCVAR("g_assault");
@@ -344,8 +350,23 @@ void cvar_changes_init()
                // now check if the changes are actually gameplay relevant
 
                // does nothing visible
-               BADPREFIX("prvm_");
+               BADCVAR("captureleadlimit_override");
+               BADCVAR("g_arena_point_leadlimit");
+               BADCVAR("g_ca_point_leadlimit");
+               BADCVAR("g_ctf_capture_leadlimit");
+               BADCVAR("g_domination_point_leadlimit");
+               BADCVAR("g_keyhunt_point_leadlimit");
+               BADCVAR("g_nexball_goalleadlimit");
+               BADCVAR("g_runematch_point_leadlimit");
+               BADCVAR("leadlimit_and_fraglimit");
+               BADCVAR("leadlimit_override");
+               BADCVAR("sv_checkforpacketsduringsleep");
                BADPREFIX("crypto_");
+               BADPREFIX("g_chat_");
+               BADPREFIX("prvm_");
+               BADPREFIX("sv_fragmessage_");
+               BADPREFIX("sv_vote_");
+               BADPREFIX("timelimit_");
 
                // allowed changes to server admins (please sync this to server.cfg)
                // vi commands:
@@ -395,13 +416,14 @@ void cvar_changes_init()
                BADCVAR("rcon_restricted_commands");
                BADCVAR("rcon_restricted_password");
                BADCVAR("skill");
+               BADCVAR("sv_adminnick");
                BADCVAR("sv_autoscreenshot");
                BADCVAR("sv_curl_defaulturl");
                BADCVAR("sv_defaultcharacter");
                BADCVAR("sv_defaultplayermodel");
                BADCVAR("sv_defaultplayerskin");
-               BADCVAR("sv_maxrate");
                BADCVAR("sv_maxidle");
+               BADCVAR("sv_maxrate");
                BADCVAR("sv_motd");
                BADCVAR("sv_public");
                BADCVAR("sv_ready_restart");
@@ -817,6 +839,8 @@ void spawnfunc_worldspawn (void)
        {
                records_reply[i] = strzone(getrecords(i));
        }
+       if(g_cts)
+               ladder_reply = strzone(getladder());
 
        rankings_reply = strzone(getrankings());
 
index 9dd7e8784845b615cea2f87ab34f512643c5012d..90b06a5a3d92a5950fa42d3213263c4f337db8e3 100644 (file)
@@ -1,5 +1,5 @@
 string GotoMap(string m);
-void race_DeleteTime(float pos);
+void race_deleteTime(string map, float pos);
 
 float FullTraceFraction(vector a, vector mi, vector ma, vector b)
 {
@@ -930,6 +930,11 @@ void GameCommand(string command)
                        print(records_reply[i]);
                return;
        }
+       if (argv(0) == "ladder")
+       {
+               print(ladder_reply);
+               return;
+       }
        if (argv(0) == "rankings")
        {
                strunzone(rankings_reply);
@@ -1346,7 +1351,11 @@ void GameCommand(string command)
        }
        if(argv(0) == "delrec")
        {
-               race_DeleteTime(stof(argv(1)));
+               if(argv(2) != "")
+                       race_deleteTime(argv(2), stof(argv(1)));
+               else
+                       race_deleteTime(GetMapname(), stof(argv(1)));
+
                return;
        }
 
index 668e86f8984003f6096b2f58e36e8086608d3928..5485cc10db74de18e27fe6442dc63fb7fdfecae2 100644 (file)
@@ -16,9 +16,6 @@ void WarpZone_crosshair_trace(entity pl)
 
 void() spawnfunc_info_player_deathmatch; // needed for the other spawnpoints
 void() spawnpoint_use;
-float race_GetTime(float pos);
-string race_GetName(float pos);
-string race_PlaceName(float pos);
 string GetMapname();
 string ColoredTeamName(float t);
 
@@ -638,6 +635,7 @@ void GetCvars(float f)
        GetCvars_handleFloat(s, f, cvar_cl_forceplayermodelsfromxonotic, "cl_forceplayermodelsfromxonotic");
 #endif
        GetCvars_handleFloatOnce(s, f, cvar_cl_gunalign, "cl_gunalign");
+       GetCvars_handleFloat(s, f, cvar_cl_allow_uid2name, "cl_allow_uid2name");
 
        // fixup of switchweapon (needed for LMS or when spectating is disabled, as PutClientInServer comes too early)
        if (f > 0)
@@ -2078,6 +2076,106 @@ void print_to(entity e, string s)
         print(s, "\n");
 }
 
+string uid2name(string myuid) {
+       string s;
+       s = db_get(ServerProgsDB, strcat("uid2name", myuid));
+       
+       if(s == "")
+               s = "^1Unregistered Player";
+       return s;
+}
+
+float race_readTime(string map, float pos)
+{
+       string rr;
+       if(g_cts)
+               rr = CTS_RECORD;
+       else
+               rr = RACE_RECORD;
+
+       return stof(db_get(ServerProgsDB, strcat(map, rr, "time", ftos(pos))));
+}
+
+string race_readUID(string map, float pos)
+{
+       string rr;
+       if(g_cts)
+               rr = CTS_RECORD;
+       else
+               rr = RACE_RECORD;
+
+       return db_get(ServerProgsDB, strcat(map, rr, "crypto_idfp", ftos(pos)));
+}
+
+float race_readPos(string map, float t) {
+       float i;
+       for (i = 1; i <= RANKINGS_CNT; ++i)
+               if (race_readTime(map, i) == 0 || race_readTime(map, i) > t)
+                       return i;
+
+       return 0; // pos is zero if unranked
+}
+
+void race_writeTime(string map, float t, string myuid)
+{
+       string rr;
+       if(g_cts)
+               rr = CTS_RECORD;
+       else
+               rr = RACE_RECORD;
+
+       float newpos;
+       newpos = race_readPos(map, t);
+
+       float i, prevpos;
+       for(i = 1; i <= RANKINGS_CNT; ++i)
+       {
+               if(race_readUID(map, i) == myuid)
+                       prevpos = i;
+       }
+       if (prevpos) { // player improved his existing record, only have to iterate on ranks between new and old recs
+               for (i = prevpos; i > newpos; --i) {
+                       db_put(ServerProgsDB, strcat(map, rr, "time", ftos(i)), ftos(race_readTime(map, i - 1)));
+                       db_put(ServerProgsDB, strcat(map, rr, "crypto_idfp", ftos(i)), race_readUID(map, i - 1));
+               }
+       } else { // player has no ranked record yet
+               for (i = RANKINGS_CNT; i > newpos; --i) {
+                       db_put(ServerProgsDB, strcat(map, rr, "time", ftos(i)), ftos(race_readTime(map, i - 1)));
+                       db_put(ServerProgsDB, strcat(map, rr, "crypto_idfp", ftos(i)), race_readUID(map, i - 1));
+               }
+       }
+
+       // store new time itself
+       db_put(ServerProgsDB, strcat(map, rr, "time", ftos(newpos)), ftos(t));
+       db_put(ServerProgsDB, strcat(map, rr, "crypto_idfp", ftos(newpos)), myuid);
+}
+
+string race_readName(string map, float pos)
+{
+       string rr;
+       if(g_cts)
+               rr = CTS_RECORD;
+       else
+               rr = RACE_RECORD;
+
+       return uid2name(db_get(ServerProgsDB, strcat(map, rr, "crypto_idfp", ftos(pos))));
+}
+
+string race_placeName(float pos) {
+       if(floor((mod(pos, 100))/10) * 10 != 10) // examples: 12th, 111th, 213th will not execute this block
+       {
+               if(mod(pos, 10) == 1)
+                       return strcat(ftos(pos), "st");
+               else if(mod(pos, 10) == 2)
+                       return strcat(ftos(pos), "nd");
+               else if(mod(pos, 10) == 3)
+                       return strcat(ftos(pos), "rd");
+               else
+                       return strcat(ftos(pos), "th");
+       }
+       else
+               return strcat(ftos(pos), "th");
+}
 string getrecords(float page) // 50 records per page
 {
     float rec;
@@ -2099,6 +2197,7 @@ string getrecords(float page) // 50 records per page
                 r = stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, "/captimerecord/time")));
                 if (r == 0)
                     continue;
+               // TODO: uid2name
                 h = db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, "/captimerecord/netname"));
                 s = strcat(s, strpad(32, MapInfo_Map_bspname), " ", strpad(-6, ftos_decimals(r, 2)), " ", h, "\n");
                 ++rec;
@@ -2112,10 +2211,10 @@ string getrecords(float page) // 50 records per page
         {
             if (MapInfo_Get_ByID(i))
             {
-                r = stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, RACE_RECORD, "time")));
+               r = race_readTime(MapInfo_Map_bspname, 1);
                 if (r == 0)
                     continue;
-                h = db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, RACE_RECORD, "netname"));
+               h = race_readName(MapInfo_Map_bspname, 1);
                 s = strcat(s, strpad(32, MapInfo_Map_bspname), " ", strpad(-8, TIME_ENCODED_TOSTRING(r)), " ", h, "\n");
                 ++rec;
             }
@@ -2128,10 +2227,10 @@ string getrecords(float page) // 50 records per page
         {
             if (MapInfo_Get_ByID(i))
             {
-                r = stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, CTS_RECORD, "time")));
+               r = race_readTime(MapInfo_Map_bspname, 1);
                 if (r == 0)
                     continue;
-                h = db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, CTS_RECORD, "netname"));
+               h = race_readName(MapInfo_Map_bspname, 1);
                 s = strcat(s, strpad(32, MapInfo_Map_bspname), " ", strpad(-8, TIME_ENCODED_TOSTRING(r)), " ", h, "\n");
                 ++rec;
             }
@@ -2161,11 +2260,11 @@ string getrankings()
 
     for (i = 1; i <= RANKINGS_CNT; ++i)
     {
-        t = race_GetTime(i);
+        t = race_readTime(map, i);
        if (t == 0)
            continue;
-       n = race_GetName(i);
-       p = race_PlaceName(i);
+       n = race_readName(map, i);
+       p = race_placeName(i);
         s = strcat(s, strpad(8, p), " ", strpad(-8, TIME_ENCODED_TOSTRING(t)), " ", n, "\n");
     }
 
@@ -2177,6 +2276,193 @@ string getrankings()
         return strcat("Records for ", map, ":\n", s);
 }
 
+#define LADDER_FIRSTPOINT 100
+#define LADDER_CNT 10
+       // position X still gives LADDER_FIRSTPOINT/X points
+#define LADDER_SIZE 30
+       // ladder shows the top X players
+string top_uids[LADDER_SIZE];
+float top_scores[LADDER_SIZE];
+string getladder()
+{
+    float i, j, k, uidcnt;
+    string s, temp_s;
+
+    s = "";
+    temp_s = "";
+
+    string rr;
+    if(g_cts)
+       rr = CTS_RECORD;
+    else
+       rr = RACE_RECORD;
+
+    string myuid;
+
+    for (k = 0; k < MapInfo_count; ++k)
+    {
+        if (MapInfo_Get_ByID(k))
+       {
+               for (i = 0; i <= LADDER_CNT; ++i) { // i = 0 because it is the speed award
+                       if(i == 0) // speed award
+                       {
+                               if(stof(db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, rr, "speed/speed"))) == 0)
+                                       continue;
+
+                               myuid = db_get(ServerProgsDB, strcat(MapInfo_Map_bspname, rr, "speed/crypto_idfp"));
+                       }
+                       else // normal record, if it exists (else break)
+                       {
+                               if(race_readTime(MapInfo_Map_bspname, i) == 0)
+                                       continue;
+
+                               myuid = race_readUID(MapInfo_Map_bspname, i);
+                       }
+
+                       // string s contains:
+                       // arg 0 = # of speed recs
+                       // arg 1 = # of 1st place recs
+                       // arg 2 = # of 2nd place recs
+                       // ... etc
+                       // LADDER_CNT+1 = total points
+
+                       temp_s = db_get(TemporaryDB, strcat("ladder", myuid));
+                       if (temp_s == "")
+                       {
+                           db_put(TemporaryDB, strcat("uid", ftos(uidcnt)), myuid);
+                           ++uidcnt;
+                           for (j = 0; j <= LADDER_CNT + 1; ++j)
+                           {
+                               if(j != LADDER_CNT + 1)
+                                   temp_s = strcat(temp_s, "0 ");
+                               else
+                                   temp_s = strcat(temp_s, "0");
+                           }
+                       }
+
+                       tokenize_console(temp_s);
+                       s = "";
+
+                       if(i == 0) // speed award
+                           for (j = 0; j <= LADDER_CNT; ++j) // loop over each arg in the string
+                           {
+                               if(j == 0) // speed award
+                                   s = strcat(s, ftos(stof(argv(j)) +1)); // add 1 to speed rec count and write
+                               else
+                                   s = strcat(s, " ", argv(j)); // just copy over everything else
+                           }
+                       else // record
+                           for (j = 0; j <= LADDER_CNT; ++j) // loop over each arg in the string
+                           {
+                               if(j == 0)
+                                   s = strcat(s, argv(j)); // speed award, dont prefix with " "
+                               else if(j == i) // wanted rec!
+                                   s = strcat(s, " ", ftos(stof(argv(j)) +1)); // update argv(j)
+                               else
+                                   s = strcat(s, " ", argv(j)); // just copy over everything else
+                           }
+
+                       // total points are (by default) calculated like this:
+                       // speedrec = floor(100 / 10) = 10 points
+                       // 1st place = floor(100 / 1) = 100 points
+                       // 2nd place = floor(100 / 2) = 50 points
+                       // 3rd place = floor(100 / 3) = 33 points
+                       // 4th place = floor(100 / 4) = 25 points
+                       // 5th place = floor(100 / 5) = 20 points
+                       // ... etc
+
+                       if(i == 0)
+                           s = strcat(s, " ", ftos(stof(argv(LADDER_CNT+1)) + LADDER_FIRSTPOINT / 10)); // speed award, add LADDER_FIRSTPOINT / 10 points
+                       else
+                           s = strcat(s, " ", ftos(stof(argv(LADDER_CNT+1)) + floor(LADDER_FIRSTPOINT / i))); // record, add LADDER_FIRSTPOINT / i points
+
+                       db_put(TemporaryDB, strcat("ladder", myuid), s);
+               }
+       }
+    }
+
+    float thiscnt;
+    string thisuid;
+    for (i = 0; i <= uidcnt; ++i) // for each known uid
+    {
+       thisuid = db_get(TemporaryDB, strcat("uid", ftos(i)));
+       temp_s = db_get(TemporaryDB, strcat("ladder", thisuid));
+       tokenize_console(temp_s);
+        thiscnt = stof(argv(LADDER_CNT+1));
+
+       if(thiscnt > top_scores[LADDER_SIZE-1])
+       for (j = 0; j < LADDER_SIZE; ++j) // for each place in ladder
+       {
+           if(thiscnt > top_scores[j])
+           {
+               for (k = LADDER_SIZE-1; k >= j; --k)
+               {
+                   top_uids[k] = top_uids[k-1];
+                   top_scores[k] = top_scores[k-1];
+               }
+               top_uids[j] = thisuid;
+               top_scores[j] = thiscnt;
+               break;
+           }
+       }
+    }
+
+    s = "^3-----------------------\n\n";
+
+    s = strcat(s, "Pos ^3|");
+    s = strcat(s, " ^7Total  ^3|");
+    for (i = 1; i <= LADDER_CNT; ++i)
+    {
+       s = strcat(s, " ^7", race_placeName(i), " ^3|");
+    }
+    s = strcat(s, " ^7Speed awards ^3| ^7Name");
+
+    s = strcat(s, "\n^3----+--------");
+    for (i = 1; i <= min(9, LADDER_CNT); ++i)
+    {
+       s = strcat(s, "+-----");
+    }
+#if LADDER_CNT > 9
+    for (i = 1; i <= LADDER_CNT - 9; ++i)
+    {
+       s = strcat(s, "+------");
+    }
+#endif
+
+    s = strcat(s, "+--------------+--------------------\n");
+
+    for (i = 0; i < LADDER_SIZE; ++i)
+    {
+       temp_s = db_get(TemporaryDB, strcat("ladder", top_uids[i]));
+       tokenize_console(temp_s);
+       if (argv(LADDER_CNT+1) == "") // total is 0, skip
+           continue;
+       s = strcat(s, strpad(4, race_placeName(i+1)), "^3| ^7"); // pos
+       s = strcat(s, strpad(7, argv(LADDER_CNT+1)), "^3| ^7"); // total
+       for (j = 1; j <= min(9, LADDER_CNT); ++j)
+       {
+           s = strcat(s, strpad(4, argv(j)), "^3| ^7"); // 1st, 2nd, 3rd etc cnt
+       }
+#if LADDER_CNT > 9
+       for (j = 10; j <= LADDER_CNT; ++j)
+       {
+           s = strcat(s, strpad(4, argv(j)), " ^3| ^7"); // 1st, 2nd, 3rd etc cnt
+       }
+#endif
+
+       s = strcat(s, strpad(13, argv(0)), "^3| ^7"); // speed award cnt
+       s = strcat(s, uid2name(top_uids[i]), "\n"); // name
+    }
+
+    MapInfo_ClearTemps();
+
+    if (s == "")
+       return "No ladder on this server!\n";
+    else
+        return strcat("Top ", ftos(LADDER_SIZE), " ladder rankings:\n", s);
+}
+
+
 float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, float badsurfaceflags, float attempts, float maxaboveground, float minviewdistance)
 {
     float m, i;
index 2f158898198aafe3b45aeedbe4a1a04979fbf6b8..3786edbe5137d25c431da79d37036f9ea7b97361 100644 (file)
@@ -98,75 +98,13 @@ void race_InitSpectator()
                        race_SendNextCheckpoint(msg_entity.enemy, 1);
 }
 
-string rr;
-float grecordtime[RANKINGS_CNT];
-string grecordholder[RANKINGS_CNT];
-string grecorduid[RANKINGS_CNT];
-float worst_time; // last ranked time
-float have_recs; // have we already read the records from the database before?
-float race_GetTime(float pos) {
-       if(g_cts)
-               rr = CTS_RECORD;
-       else
-               rr = RACE_RECORD;
-
-       if (!have_recs) { // I guess this is better than checking if the first array item is empty, rumor has it that arrays are slow
-               float i;
-               for(i=0;i<RANKINGS_CNT;++i) {
-                       grecordtime[i] = stof(db_get(ServerProgsDB, strcat(GetMapname(), rr, "time", ftos(i))));
-                       grecordholder[i] = strzone(db_get(ServerProgsDB, strcat(GetMapname(), rr, "netname", ftos(i))));
-                       grecorduid[i] = strzone(db_get(ServerProgsDB, strcat(GetMapname(), rr, "crypto_idfp", ftos(i))));
-               }
-               grecordtime[0] = stof(db_get(ServerProgsDB, strcat(GetMapname(), rr, "time")));
-               grecordholder[0] = strzone(db_get(ServerProgsDB, strcat(GetMapname(), rr, "netname")));
-               grecorduid[0] = strzone(db_get(ServerProgsDB, strcat(GetMapname(), rr, "crypto_idfp")));
-               worst_time = stof(db_get(ServerProgsDB, strcat(GetMapname(), rr, strcat("time", ftos(RANKINGS_CNT-1)))));
-               have_recs = 1;
-       }
-
-       return grecordtime[pos-1];
-}
-
-string race_GetName(float pos) { // these other functions assume that race_GetTime has been called >= once before
-       return grecordholder[pos-1];
-}
-
-float race_CheckUID(string myuid, string net_name) { // return existing UID or player name ranking pos, else 0
-       float i;
-       if(myuid)
-       {
-               for (i=RANKINGS_CNT-1;i>=0;--i)
-                       if(grecorduid[i] == myuid)
-                               return i+1;
-       }
-       for (i=RANKINGS_CNT-1;i>=0;--i)
-               if(!grecorduid[i])
-                       if(grecordholder[i] == net_name)
-                               return i+1;
-       return 0;
-}
-
-float race_GetPos(float t) {
-       float i;
-
-       if(worst_time == 0)
-       for (i=0;i<RANKINGS_CNT;++i)
-               if (grecordtime[i] == 0 || grecordtime[i] > t)
-                       return i+1;
-
-       for (i=0;i<RANKINGS_CNT;++i)
-               if (grecordtime[i] > t)
-                       return i+1;
-       return 0;
-}
-
 void race_send_recordtime(float msg)
 {
        // send the server best time
        WriteByte(msg, SVC_TEMPENTITY);
        WriteByte(msg, TE_CSQC_RACE);
        WriteByte(msg, RACE_NET_SERVER_RECORD);
-       WriteInt24_t(msg, race_GetTime(1));
+       WriteInt24_t(msg, race_readTime(GetMapname(), 1));
 }
 
 void race_SendRankings(float pos, float prevpos, float del, float msg)
@@ -177,8 +115,8 @@ void race_SendRankings(float pos, float prevpos, float del, float msg)
        WriteShort(msg, pos);
        WriteShort(msg, prevpos);
        WriteShort(msg, del);
-       WriteString(msg, race_GetName(pos));
-       WriteInt24_t(msg, race_GetTime(pos));
+       WriteString(msg, race_readName(GetMapname(), pos));
+       WriteInt24_t(msg, race_readTime(GetMapname(), pos));
 }
 
 void race_SendStatus(float id, entity e)
@@ -198,179 +136,99 @@ void race_SendStatus(float id, entity e)
        });
 }
 
-string race_PlaceName(float pos) {
-       if(pos == 1)
-               return "1st";
-       else if(pos == 2)
-               return "2nd";
-       else if(pos == 3)
-               return "3rd";
-       else
-               return strcat(ftos(pos), "th");
-}
+void race_setTime(string map, float t, string myuid, string mynetname, entity e) { // netname only used TEMPORARILY for printing
+       float newpos, player_prevpos;
+       newpos = race_readPos(map, t);
 
-void race_SetTime(entity e, float t, float match_rec) {
-       float pos, prevpos;
-       pos = race_GetPos(t);
-       prevpos = race_CheckUID(e.crypto_idfp, e.netname);
+       float i;
+       for(i = 1; i <= RANKINGS_CNT; ++i)
+       {
+               if(race_readUID(map, i) == myuid)
+                       player_prevpos = i;
+       }
 
        float oldrec;
-       string recorddifference;
-       if (prevpos && (prevpos < pos || !pos))
+       string recorddifference, oldrec_holder;
+       if (player_prevpos && (player_prevpos < newpos || !newpos))
        {
-               oldrec = race_GetTime(prevpos);
+               oldrec = race_readTime(GetMapname(), player_prevpos);
                recorddifference = strcat(" ^1[+", TIME_ENCODED_TOSTRING(t - oldrec), "]");
-               bprint(e.netname, "^7 couldn't break their ", race_PlaceName(prevpos), " place record of ", TIME_ENCODED_TOSTRING(oldrec), recorddifference, "\n");
+               bprint(mynetname, "^7 couldn't break their ", race_placeName(player_prevpos), " place record of ", TIME_ENCODED_TOSTRING(oldrec), recorddifference, "\n");
                race_SendStatus(0, e); // "fail"
+               Send_KillNotification(e.netname, TIME_ENCODED_TOSTRING(t), "", RACE_FAIL, MSG_RACE);
                return;
-       } else if (!pos) { // no ranking, time worse than the worst ranked
-               recorddifference = strcat(" ^1[+", TIME_ENCODED_TOSTRING(t - grecordtime[RANKINGS_CNT-1]), "]");
-               bprint(e.netname, "^7 couldn't break the ", race_PlaceName(RANKINGS_CNT), " place record of ", TIME_ENCODED_TOSTRING(grecordtime[RANKINGS_CNT-1]), recorddifference, "\n");
+       } else if (!newpos) { // no ranking, time worse than the worst ranked
+               recorddifference = strcat(" ^1[+", TIME_ENCODED_TOSTRING(t - race_readTime(GetMapname(), RANKINGS_CNT)), "]");
+               bprint(mynetname, "^7 couldn't break the ", race_placeName(RANKINGS_CNT), " place record of ", TIME_ENCODED_TOSTRING(race_readTime(GetMapname(), RANKINGS_CNT)), recorddifference, "\n");
                race_SendStatus(0, e); // "fail"
+               Send_KillNotification(e.netname, TIME_ENCODED_TOSTRING(t), "", RACE_FAIL, MSG_RACE);
                return;
        }
 
-       oldrec = grecordtime[pos-1];
+       // if we didn't hit a return yet, we have a new record!
 
-       // move other rankings out of the way
-       float i;
-       if (prevpos) { // player improved his existing record
-               for (i=prevpos-1;i>pos-1;--i) {
-                       db_put(ServerProgsDB, strcat(GetMapname(), rr, "time", ftos(i)), ftos(grecordtime[i-1]));
-                       db_put(ServerProgsDB, strcat(GetMapname(), rr, "netname", ftos(i)), grecordholder[i-1]);
-                       db_put(ServerProgsDB, strcat(GetMapname(), rr, "crypto_idfp", ftos(i)), grecorduid[i-1]);
-                       grecordtime[i] = grecordtime[i-1];
-
-                       if (grecordholder[i])
-                               strunzone(grecordholder[i]);
-                       grecordholder[i] = strzone(grecordholder[i-1]);
-                       if (grecorduid[i])
-                               strunzone(grecorduid[i]);
-                       grecorduid[i] = strzone(grecorduid[i-1]);
-               }
-       } else { // player has no ranked record yet
-               for (i=RANKINGS_CNT-1;i>pos-1;--i) {
-                       db_put(ServerProgsDB, strcat(GetMapname(), rr, "time", ftos(i)), ftos(grecordtime[i-1]));
-                       db_put(ServerProgsDB, strcat(GetMapname(), rr, "netname", ftos(i)), grecordholder[i-1]);
-                       db_put(ServerProgsDB, strcat(GetMapname(), rr, "crypto_idfp", ftos(i)), grecorduid[i-1]);
-                       grecordtime[i] = grecordtime[i-1];
-
-                       if (grecordholder[i])
-                               strunzone(grecordholder[i]);
-                       grecordholder[i] = strzone(grecordholder[i-1]);
-                       if (grecorduid[i])
-                               strunzone(grecorduid[i]);
-                       grecorduid[i] = strzone(grecorduid[i-1]);
-               }
-       }
+       oldrec = race_readTime(GetMapname(), newpos);
+       oldrec_holder = race_readName(GetMapname(), newpos);
        
        // store new ranking
-       if (pos == 1) {
-               db_put(ServerProgsDB, strcat(GetMapname(), rr, "time"), ftos(t));
-               db_put(ServerProgsDB, strcat(GetMapname(), rr, "netname"), e.netname);
-               db_put(ServerProgsDB, strcat(GetMapname(), rr, "crypto_idfp"), e.crypto_idfp);
-
-               grecordtime[0] = t;
-
-               if (grecordholder[0])
-                       strunzone(grecordholder[0]);
-               grecordholder[0] = strzone(e.netname);
-               if (grecorduid[0])
-                       strunzone(grecorduid[0]);
-               grecorduid[0] = strzone(e.crypto_idfp);
+       race_writeTime(GetMapname(), t, myuid);
+
+       if (newpos == 1) {
                write_recordmarker(e, time - TIME_DECODE(t), TIME_DECODE(t));
                race_send_recordtime(MSG_ALL);
-       } else {
-               db_put(ServerProgsDB, strcat(GetMapname(), rr, "time", ftos(pos-1)), ftos(t));
-               db_put(ServerProgsDB, strcat(GetMapname(), rr, "netname", ftos(pos-1)), e.netname);
-               db_put(ServerProgsDB, strcat(GetMapname(), rr, "crypto_idfp", ftos(pos-1)), e.crypto_idfp);
-
-               grecordtime[pos-1] = t;
-
-               if (grecordholder[pos-1])
-                       strunzone(grecordholder[pos-1]);
-               grecordholder[pos-1] = strzone(e.netname);
-               if (grecorduid[pos-1])
-                       strunzone(grecorduid[pos-1]);
-               grecorduid[pos-1] = strzone(e.crypto_idfp);
        }
 
-       if (pos == RANKINGS_CNT)
-               worst_time = t;
-
-       race_SendRankings(pos, prevpos, 0, MSG_ALL);
+       race_SendRankings(newpos, player_prevpos, 0, MSG_ALL);
        if(rankings_reply)
                strunzone(rankings_reply);
        rankings_reply = strzone(getrankings());
-       if(pos == 1) {
-               if(pos == prevpos) {
+       if(newpos == 1) {
+               if(newpos == player_prevpos) {
                        recorddifference = strcat(" ^2[-", TIME_ENCODED_TOSTRING(oldrec - t), "]");
-                       bprint(e.netname, "^1 improved their 1st place record with ", TIME_ENCODED_TOSTRING(t), recorddifference, "\n");
+                       bprint(mynetname, "^1 improved their 1st place record with ", TIME_ENCODED_TOSTRING(t), recorddifference, "\n");
                } else if (oldrec == 0) {
-                       bprint(e.netname, "^1 set the 1st place record with ", TIME_ENCODED_TOSTRING(t), "\n");
+                       bprint(mynetname, "^1 set the 1st place record with ", TIME_ENCODED_TOSTRING(t), "\n");
                } else {
                        recorddifference = strcat(" ^2[-", TIME_ENCODED_TOSTRING(oldrec - t), "]");
-                       bprint(e.netname, "^1 broke ", grecordholder[pos], "^1's 1st place record with ", strcat(TIME_ENCODED_TOSTRING(t), recorddifference, "\n"));
+                       bprint(mynetname, "^1 broke ", oldrec_holder, "^1's 1st place record with ", strcat(TIME_ENCODED_TOSTRING(t), recorddifference, "\n"));
                }
                race_SendStatus(3, e); // "new server record"
+               Send_KillNotification(e.netname, TIME_ENCODED_TOSTRING(t), "", RACE_SERVER_RECORD, MSG_RACE);
        } else {
-               if(pos == prevpos) {
+               if(newpos == player_prevpos) {
                        recorddifference = strcat(" ^2[-", TIME_ENCODED_TOSTRING(oldrec - t), "]");
-                       bprint(e.netname, "^5 improved their ", race_PlaceName(pos), " ^5place record with ", TIME_ENCODED_TOSTRING(t), recorddifference, "\n");
+                       bprint(mynetname, "^5 improved their ", race_placeName(newpos), " ^5place record with ", TIME_ENCODED_TOSTRING(t), recorddifference, "\n");
                        race_SendStatus(1, e); // "new time"
+                       Send_KillNotification(e.netname, TIME_ENCODED_TOSTRING(t), "", RACE_NEW_TIME, MSG_RACE);
                } else if (oldrec == 0) {
-                       bprint(e.netname, "^2 set the ", race_PlaceName(pos), " ^2place record with ", TIME_ENCODED_TOSTRING(t), "\n");
+                       bprint(mynetname, "^2 set the ", race_placeName(newpos), " ^2place record with ", TIME_ENCODED_TOSTRING(t), "\n");
                        race_SendStatus(2, e); // "new rank"
+                       Send_KillNotification(e.netname, TIME_ENCODED_TOSTRING(t), "", RACE_NEW_RANK, MSG_RACE);
                } else {
                        recorddifference = strcat(" ^2[-", TIME_ENCODED_TOSTRING(oldrec - t), "]");
-                       bprint(e.netname, "^2 broke ", grecordholder[pos], "^2's ", race_PlaceName(pos), " ^2place record with ", strcat(TIME_ENCODED_TOSTRING(t), recorddifference, "\n"));
+                       bprint(mynetname, "^2 broke ", oldrec_holder, "^2's ", race_placeName(newpos), " ^2place record with ", strcat(TIME_ENCODED_TOSTRING(t), recorddifference, "\n"));
                        race_SendStatus(2, e); // "new rank"
+                       Send_KillNotification(e.netname, TIME_ENCODED_TOSTRING(t), "", RACE_NEW_TIME, MSG_RACE);
                }
        }
 }
 
-void race_DeleteTime(float pos) {
-       float i;
+void race_deleteTime(string map, float pos) {
+       string rr;
+       if(g_cts)
+               rr = CTS_RECORD;
+       else
+               rr = RACE_RECORD;
 
-       for (i = pos-1; i <= RANKINGS_CNT-1; ++i) {
-               if (i == 0) {
-                       db_put(ServerProgsDB, strcat(GetMapname(), rr, "time"), ftos(grecordtime[1]));
-                       db_put(ServerProgsDB, strcat(GetMapname(), rr, "netname"), grecordholder[1]);
-                       db_put(ServerProgsDB, strcat(GetMapname(), rr, "crypto_idfp"), grecorduid[1]);
-                       grecordtime[0] = grecordtime[1];
-                       if (grecordholder[i])
-                               strunzone(grecordholder[0]);
-                       grecordholder[0] = strzone(grecordholder[1]);
-
-                       if (grecorduid[i])
-                               strunzone(grecorduid[0]);
-                       grecorduid[0] = strzone(grecorduid[1]);
-               }
-               else if (i == RANKINGS_CNT-1) {
-                       db_put(ServerProgsDB, strcat(GetMapname(), rr, "time", ftos(i)), string_null);
-                       db_put(ServerProgsDB, strcat(GetMapname(), rr, "netname", ftos(i)), string_null);
-                       db_put(ServerProgsDB, strcat(GetMapname(), rr, "crypto_idfp", ftos(i)), string_null);
-                       grecordtime[i] = 0;
-                       if (grecordholder[i])
-                               strunzone(grecordholder[i]);
-                       grecordholder[i] = string_null;
-
-                       if (grecorduid[i])
-                               strunzone(grecorduid[i]);
-                       grecorduid[i] = string_null;
+       float i;
+       for (i = pos; i <= RANKINGS_CNT; ++i) {
+               if (i == RANKINGS_CNT) {
+                       db_put(ServerProgsDB, strcat(map, rr, "time", ftos(i)), string_null);
+                       db_put(ServerProgsDB, strcat(map, rr, "crypto_idfp", ftos(i)), string_null);
                }
                else {
-                       db_put(ServerProgsDB, strcat(GetMapname(), rr, "time", ftos(i)), ftos(grecordtime[i+1]));
-                       db_put(ServerProgsDB, strcat(GetMapname(), rr, "netname", ftos(i)), grecordholder[i+1]);
-                       db_put(ServerProgsDB, strcat(GetMapname(), rr, "crypto_idfp", ftos(i)), grecorduid[i+1]);
-                       grecordtime[i] = grecordtime[i+1];
-                       if (grecordholder[i])
-                               strunzone(grecordholder[i]);
-                       grecordholder[i] = strzone(grecordholder[i+1]);
-
-                       if (grecorduid[i])
-                               strunzone(grecorduid[i]);
-                       grecorduid[i] = strzone(grecorduid[i+1]);
+                       db_put(ServerProgsDB, strcat(map, rr, "time", ftos(i)), ftos(race_readTime(GetMapname(), i+1)));
+                       db_put(ServerProgsDB, strcat(map, rr, "crypto_idfp", ftos(i)), race_readUID(GetMapname(), i+1));
                }
        }
 
@@ -381,8 +239,6 @@ void race_DeleteTime(float pos) {
        if(rankings_reply)
                strunzone(rankings_reply);
        rankings_reply = strzone(getrankings());
-
-       worst_time = 0;
 }
 
 void race_SendTime(entity e, float cp, float t, float tvalid)
@@ -441,8 +297,13 @@ void race_SendTime(entity e, float cp, float t, float tvalid)
 
                        if(t != 0) {
                                if(cp == race_timed_checkpoint)
-                                       race_SetTime(e, t, recordtime);
-
+                               {
+                                       race_setTime(GetMapname(), t, e.crypto_idfp, e.netname, e);
+                                       if(g_cts && cvar("g_cts_finish_kill_delay"))
+                                       {
+                                               CTS_ClientKill(cvar("g_cts_finish_kill_delay"));
+                                       }
+                               }
                                if(t < recordtime || recordtime == 0)
                                {
                                        race_checkpoint_records[cp] = t;
index cffe88bd7fff5acfe21bc2ca98f26af4ffe99bcf..3d3f1d626ec0f43c99ea5839e5d5315f66beaab5 100644 (file)
@@ -39,12 +39,29 @@ void spawnfunc_item_armor_combat()   { spawnfunc_item_armor_big();      }
 void spawnfunc_item_armor_shard()    { spawnfunc_item_armor_small();    }
 void spawnfunc_item_enviro()         { spawnfunc_item_invincible();     }
 
-// weapon remove ent from defrag
+// weapon remove ent from df
+void target_init_verify()
+{
+       entity trigger, targ;
+       for(trigger = world; (trigger = find(trigger, classname, "trigger_multiple")); )
+               for(targ = world; (targ = find(targ, targetname, trigger.target)); )
+                       if (targ.classname == "target_init" || targ.classname == "target_give" || targ.classname == "target_items")
+                       {
+                               targ.wait = -2;
+                               targ.delay = 0;
+
+                               setsize(targ, trigger.mins, trigger.maxs);
+                               setorigin(targ, trigger.origin);
+                               //remove(trigger);
+                       }
+}
+
 void spawnfunc_target_init()
 {
        self.spawnflags = 0; // remove all weapons except the ones listed below
        self.netname = "laser uzi"; // keep these weapons through the remove trigger
        spawnfunc_target_items();
+       InitializeEntity(self, target_init_verify, INITPRIO_FINDTARGET);
 }
 
 // weapon give ent from defrag
@@ -85,6 +102,7 @@ void target_give_init()
        }
        self.spawnflags = 2;
        spawnfunc_target_items();
+       InitializeEntity(self, target_init_verify, INITPRIO_FINDTARGET);
 }
 
 void spawnfunc_target_give()
index f47077a2573ff286b9e400d88ec6399a43ca1cd3..c5f1ed12c02143b993bb15d92e7c3d27c7c4d5b1 100644 (file)
@@ -146,6 +146,7 @@ float w_shotgun(float req)
 };
 #endif
 #ifdef CSQC
+.float prevric;
 float w_shotgun(float req)
 {
        if(req == WR_IMPACTEFFECT)
@@ -153,14 +154,15 @@ float w_shotgun(float req)
                vector org2;
                org2 = w_org + w_backoff * 2;
                pointparticles(particleeffectnum("shotgun_impact"), org2, w_backoff * 1000, 1);
-               if(!w_issilent)
+               if(!w_issilent && time - self.prevric > 0.25)
                {
-                       if(w_random < 0.05)
+                       if(w_random < 0.0165)
                                sound(self, CHAN_PROJECTILE, "weapons/ric1.wav", VOL_BASE, ATTN_NORM);
-                       else if(w_random < 0.1)
+                       else if(w_random < 0.033)
                                sound(self, CHAN_PROJECTILE, "weapons/ric2.wav", VOL_BASE, ATTN_NORM);
-                       else if(w_random < 0.2)
+                       else if(w_random < 0.05)
                                sound(self, CHAN_PROJECTILE, "weapons/ric3.wav", VOL_BASE, ATTN_NORM);
+                       self.prevric = time;
                }
        }
        else if(req == WR_PRECACHE)