From: FruitieX Date: Tue, 26 Oct 2010 15:42:55 +0000 (+0300) Subject: Merge remote branch 'origin/master' into fruitiex/racefixes X-Git-Tag: xonotic-v0.1.0preview~202^2~15 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=4c1fcf7b3bdaee8fd10d48d2ac5b21c3a9371de1;hp=-c Merge remote branch 'origin/master' into fruitiex/racefixes --- 4c1fcf7b3bdaee8fd10d48d2ac5b21c3a9371de1 diff --combined defaultXonotic.cfg index a5558f947c,0ba520e135..0a959f207e --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@@ -615,6 -615,8 +615,8 @@@ set g_arena_respawn_delay set g_arena_respawn_waves 0 set g_ca_respawn_delay 0 set g_ca_respawn_waves 0 + set g_ca_damage2score_multiplier 0.01 + set g_ca_round_timelimit 180 set g_nexball_respawn_delay 0 set g_nexball_respawn_waves 0 set g_as_respawn_delay 0 @@@ -624,9 -626,8 +626,9 @@@ set g_ons_respawn_waves 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" @@@ -1649,7 -1650,6 +1651,7 @@@ set g_showweaponspawns 1 "display sprit 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 @@@ -1990,6 -1990,3 +1992,6 @@@ utf8_enable r_font_hinting 1 r_font_disable_freetype 0 r_font_size_snapping 2 + +// 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)" diff --combined qcsrc/client/hud.qc index d752235b41,7ce1a202d6..b341f10515 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@@ -2593,9 -2593,6 +2593,9 @@@ void HUD_KillNotify(string s1, string 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 && 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)) { @@@ -2922,19 -2919,6 +2922,19 @@@ 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); + } } } @@@ -3271,22 -3255,6 +3271,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); @@@ -3777,22 -3745,11 +3777,22 @@@ float vote_change; // "time" when vote_ void HUD_VoteWindow(void) { + if(autocvar_cl_allow_uid2name == -1 && (gametype == GAME_CTS || gametype == GAME_RACE)) + { + vote_active = 1; + vote_called_vote = "^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; @@@ -3858,22 -3815,16 +3858,22 @@@ 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 @@@ -3908,6 -3859,37 +3908,37 @@@ float mod_active; // is there any active mod icon? + // Clan Arena HUD modicons + void HUD_Mod_CA(vector pos, vector mySize) + { + mod_active = 1; // CA should never hide the mod icons panel + float redalive, bluealive; + redalive = getstati(STAT_REDALIVE); + bluealive = getstati(STAT_BLUEALIVE); + + drawfont = hud_bigfont; + vector redpos, bluepos; + if(mySize_x > mySize_y) + { + redpos = pos; + bluepos = pos + eY * 0.5 * mySize_y; + drawpic_aspect_skin(redpos, "player_red.tga", 0.5 * mySize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + drawstring_aspect(redpos + eX * 0.5 * mySize_x, ftos(redalive), 0.5 * mySize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + drawpic_aspect_skin(bluepos, "player_blue.tga", 0.5 * mySize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + drawstring_aspect(bluepos + eX * 0.5 * mySize_x, ftos(bluealive), 0.5 * mySize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + } + else + { + redpos = pos; + bluepos = pos + eY * 0.5 * mySize_y; + drawpic_aspect_skin(redpos, "player_red.tga", eX * mySize_x + eY * 0.3 * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + drawstring_aspect(redpos + eY * 0.3 * mySize_y, ftos(redalive), eX * mySize_x + eY * 0.2 * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + drawpic_aspect_skin(bluepos, "player_blue.tga", eX * mySize_x + eY * 0.3 * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + drawstring_aspect(bluepos + eY * 0.3 * mySize_y, ftos(bluealive), eX * mySize_x + eY * 0.2 * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); + } + drawfont = hud_font; + } + // CTF HUD modicon section float redflag_prevframe, blueflag_prevframe; // status during previous frame float redflag_prevstatus, blueflag_prevstatus; // last remembered status @@@ -4404,7 -4386,7 +4435,7 @@@ void HUD_ModIcons(void if(!autocvar_hud_panel_modicons && !autocvar__hud_configure) return; - if (gametype != GAME_KEYHUNT && gametype != GAME_CTF && gametype != GAME_NEXBALL && gametype != GAME_CTS && gametype != GAME_RACE && !autocvar__hud_configure) + if (gametype != GAME_KEYHUNT && gametype != GAME_CTF && gametype != GAME_NEXBALL && gametype != GAME_CTS && gametype != GAME_RACE && gametype != GAME_CA && !autocvar__hud_configure) return; active_panel = HUD_PANEL_MODICONS; @@@ -4441,6 -4423,8 +4472,8 @@@ HUD_Mod_NexBall(pos, mySize); else if(gametype == GAME_CTS || gametype == GAME_RACE) HUD_Mod_Race(pos, mySize); + else if(gametype == GAME_CA) + HUD_Mod_CA(pos, mySize); } // Draw pressed keys (#11) diff --combined qcsrc/common/constants.qh index c1455af452,b4b92ff8bd..4dd3bf76e3 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@@ -310,6 -310,7 +310,7 @@@ const float STAT_SHOTORG = 46; // compr const float STAT_LEADLIMIT = 47; const float STAT_BULLETS_LOADED = 48; const float STAT_NEX_CHARGE = 49; + const float STAT_HUD = 50; // see DP source, quakedef.h const float STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW = 222; @@@ -320,7 -321,6 +321,6 @@@ const float CTF_STATE_ATTACK = 1 const float CTF_STATE_DEFEND = 2; const float CTF_STATE_COMMANDER = 3; - const float STAT_HUD = 50; const float HUD_NORMAL = 0; const float HUD_SPIDERBOT = 10; const float HUD_WAKIZASHI = 11; @@@ -337,6 -337,10 +337,10 @@@ const float STAT_VEHICLESTAT_RELOAD1 = const float STAT_VEHICLESTAT_AMMO2 = 65; const float STAT_VEHICLESTAT_RELOAD2 = 66; + // mod stats (1xx) + const float STAT_REDALIVE = 100; + const float STAT_BLUEALIVE = 101; + //const float STAT_SPIDERBOT_AIM 53 // compressShotOrigin //const float STAT_SPIDERBOT_TARGET 54 // compressShotOrigin @@@ -560,8 -564,6 +564,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; @@@ -587,11 -589,6 +591,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 diff --combined qcsrc/server/cl_client.qc index a5ec05c02f,bb2b753b84..76f81c8d74 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@@ -1305,25 -1305,14 +1305,30 @@@ void ClientKill_TeamChange (float targe void ClientKill (void) { - ClientKill_TeamChange(0); + if((g_arena || g_ca) && ((champion && champion.classname == "player" && player_count > 1) || player_count == 1)) // don't allow a kill in this case either + { + // do nothing + } + else + 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; @@@ -1598,12 -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; @@@ -3026,18 -3014,6 +3031,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))); diff --combined qcsrc/server/clientcommands.qc index a11ab82f99,b705e9c09c..a92da718fe --- a/qcsrc/server/clientcommands.qc +++ b/qcsrc/server/clientcommands.qc @@@ -303,8 -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") { @@@ -432,7 -430,7 +432,7 @@@ void ReadyRestartForce( readyrestart_happened = 1; game_starttime = time; - if(!g_ca) + if(!g_ca && !g_arena) game_starttime += RESTART_COUNTDOWN; restart_mapalreadyrestarted = 0; //reset this var, needed when cvar sv_ready_restart_repeatable is in use @@@ -450,7 -448,7 +450,7 @@@ } //initiate the restart-countdown-announcer entity - if(cvar("sv_ready_restart_after_countdown")) + if(cvar("sv_ready_restart_after_countdown") && !g_ca && !g_arena) { restartTimer = spawn(); restartTimer.think = restartTimer_Think; diff --combined qcsrc/server/defs.qh index 74e5d428f3,745a6e0b2a..9295547c53 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@@ -329,9 -329,6 +329,9 @@@ float sv_loddistance2 .float cvar_cl_gunalign; .float cvar_cl_noantilag; +.float cvar_cl_allow_uid2name; +.string stored_netname; + void Announce(string snd); void AnnounceTo(entity e, string snd); @@@ -654,3 -651,5 +654,5 @@@ string deathmessage .entity realowner; .float nex_charge; + + float allowed_to_spawn; // boolean variable used by the clan arena code to determine if a player can spawn (after the round has ended) diff --combined qcsrc/server/g_world.qc index 053ed5124b,6260d7e86d..b761e97c76 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@@ -440,6 -440,8 +440,8 @@@ void spawnfunc_worldspawn (void compressShortVector_init(); + allowed_to_spawn = TRUE; + local entity head; head = nextent(world); maxclients = 0; @@@ -642,6 -644,11 +644,11 @@@ addstat(STAT_NEX_CHARGE, AS_FLOAT, nex_charge); + if(g_ca) + { + addstat(STAT_REDALIVE, AS_INT, redalive_stat); + addstat(STAT_BLUEALIVE, AS_INT, bluealive_stat); + } // g_movementspeed hack addstat(STAT_MOVEVARS_AIRSPEEDLIMIT_NONQW, AS_FLOAT, stat_sv_airspeedlimit_nonqw); addstat(STAT_MOVEVARS_AIRACCEL_QW, AS_FLOAT, stat_sv_airaccel_qw); @@@ -697,8 -704,6 +704,8 @@@ { records_reply[i] = strzone(getrecords(i)); } + if(g_cts) + ladder_reply = strzone(getladder()); rankings_reply = strzone(getrankings());