From 610de6f48f95d06df22edb520a0b42c95c412df8 Mon Sep 17 00:00:00 2001 From: Samual Lenks Date: Wed, 6 Feb 2013 19:01:52 -0500 Subject: [PATCH] Add cl_client.qc notifications mostly by Mario-- Still needs some fixes --- gamemodes.cfg | 1 - qcsrc/common/constants.qh | 3 -- qcsrc/common/notifications.qc | 18 ++++--- qcsrc/common/notifications.qh | 36 +++++++++++++ qcsrc/server/autocvars.qh | 1 - qcsrc/server/cl_client.qc | 93 ++++++++++++++++------------------ qcsrc/server/command/cmd.qc | 2 + qcsrc/server/command/sv_cmd.qc | 2 +- 8 files changed, 93 insertions(+), 63 deletions(-) diff --git a/gamemodes.cfg b/gamemodes.cfg index 727b0775a..c1e3f43e3 100644 --- a/gamemodes.cfg +++ b/gamemodes.cfg @@ -342,7 +342,6 @@ set g_lms 0 "Last Man Standing: everyone starts with a certain amount of lives, set g_lms_lives_override -1 set g_lms_regenerate 0 set g_lms_campcheck_interval 10 -set g_lms_campcheck_message "^1Don't camp!" set g_lms_campcheck_damage 100 set g_lms_campcheck_distance 1800 set g_lms_last_join 3 "if g_lms_join_anytime is false, new players can only join if the worst active player has more than (fraglimit - g_lms_last_join) lives" diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index 6dc75e42e..a2562bc18 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -379,17 +379,14 @@ float WATERLEVEL_SUBMERGED = 3; float MAX_SHOT_DISTANCE = 32768; //centerprint ID list -float CPID_TEAMCHANGE = 1; float CPID_CTF_CAPTURESHIELD = 2; float CPID_MINSTA_FINDAMMO = 3; float CPID_NIX_WPNCHANGE = 4; -float CPID_DISCONNECT_IDLING = 5; float CPID_ROUND_STARTING = 6; float CPID_GAME_STARTING = 7; float CPID_TIMEOUT_COUNTDOWN = 8; float CPID_MOTD = 9; float CPID_KH_MSG = 10; -float CPID_PREVENT_JOIN = 11; // weapon requests float WR_SETUP = 1; // (SVQC) setup weapon data diff --git a/qcsrc/common/notifications.qc b/qcsrc/common/notifications.qc index dd899d00f..437f51e17 100644 --- a/qcsrc/common/notifications.qc +++ b/qcsrc/common/notifications.qc @@ -18,18 +18,22 @@ string TCR(string input, string teamcolor, string teamtext) // TODO: MOVE TO UTI // color code replace, place inside of sprintf and parse the string string CCR(string input) // TODO: MOVE TO UTIL.QC { + // Default colors listed in comments + // foreground/normal colors - input = strreplace("^F1", "^2", input); // primary priority (important names, etc) - input = strreplace("^F2", "^3", input); // secondary priority (items, locations, numbers, etc) + input = strreplace("^F1", "^2", input); // Green // primary priority (important names, etc) + input = strreplace("^F2", "^3", input); // Yellow // secondary priority (items, locations, numbers, etc) + input = strreplace("^F3", "^4", input); // Blue // tertiary priority or relatively inconsequential text + input = strreplace("^F4", "^1", input); // Red // notice/attention grabbing texting // "kill" colors - input = strreplace("^K1", "^1", input); // "bad" or "dangerous" text (death messages against you, kill notifications, etc) - input = strreplace("^K2", "^3", input); // similar to above, but less important... OR, a highlight out of above message type - input = strreplace("^K3", "^4", input); // "good" or "beneficial" text (you fragging someone, etc) + input = strreplace("^K1", "^1", input); // Red // "bad" or "dangerous" text (death messages against you, kill notifications, etc) + input = strreplace("^K2", "^3", input); // Yellow // similar to above, but less important... OR, a highlight out of above message type + input = strreplace("^K3", "^4", input); // Blue // "good" or "beneficial" text (you fragging someone, etc) // background colors - input = strreplace("^BG", "^7", input); // neutral/unimportant text - input = strreplace("^N", "^7", input); // "none"-- reset to white... + input = strreplace("^BG", "^7", input); // White // neutral/unimportant text + input = strreplace("^N", "^7", input); // White // "none"-- reset to white... return input; } diff --git a/qcsrc/common/notifications.qh b/qcsrc/common/notifications.qh index 8230905b1..8b6298c3d 100644 --- a/qcsrc/common/notifications.qh +++ b/qcsrc/common/notifications.qh @@ -291,13 +291,39 @@ void Send_CSQC_Centerprint_Generic_Expire(entity e, float id); MSG_INFO_NOTIF(INFO_FREEZETAG_REVIVE, 2, 0, XPD(s1, s2), XPD("", ""), "", _("^BG%s^K3 was revived by ^BG%s\n"), "") \ MSG_INFO_NOTIF(INFO_FREEZETAG_FREEZE, 2, 0, XPD(s1, s2), XPD("", ""), "", _("^BG%s^K1 was frozen by ^BG%s\n"), "") \ MSG_INFO_NOTIF(INFO_FREEZETAG_SELF, 1, 0, s1, XPD("", ""), "", _("^BG%s^K1 froze themself\n"), "") \ + MSG_INFO_NOTIF(INFO_GODMODE_OFF, 0, 1, f1, XPD("", ""), "", _("^BGGodmode saved you %d units of damage, cheater!\n"), "") \ + MSG_INFO_NOTIF(INFO_JOIN_CONNECT, 1, 0, s1, XPD("", ""), "", _("^BG%s^F3 connected%s\n"), "") \ + MULTITEAM_INFO(INFO_JOIN_CONNECT_TEAM_, 4, 1, 0, s1, XPD("", ""), "", _("^BG%s^F3 connected and joined the ^TC^TT\n"), "") \ + MSG_INFO_NOTIF(INFO_JOIN_PLAY, 1, 0, s1, XPD("", ""), "", _("^BG%s^F3 is now playing\n"), "") \ MSG_INFO_NOTIF(INFO_KEEPAWAY_DROPPED, 1, 0, s1, XPD(s1, ""), "notify_balldropped", _("^BG%s^BG has dropped the ball!\n"), "") \ MSG_INFO_NOTIF(INFO_KEEPAWAY_PICKUP, 1, 0, s1, XPD(s1, ""), "notify_ballpickedup", _("^BG%s^BG has picked up the ball!\n"), "") \ + MSG_INFO_NOTIF(INFO_LMS_NOLIVES, 1, 0, s1, XPD(s1, ""), "", _("^BG%s^F3 has no more lives left\n"), "") \ + MSG_INFO_NOTIF(INFO_LMS_FORFEIT, 1, 0, s1, XPD(s1, ""), "", _("^BG%s^F3 forfeited\n"), "") \ + MSG_INFO_NOTIF(INFO_POWERDOWN_INVISIBILITY, 0, 0, NO_STR_ARG, XPD("", ""), "", _("^F2Invisibility has worn off\n"), "") \ + MSG_INFO_NOTIF(INFO_POWERDOWN_SHIELD, 0, 0, NO_STR_ARG, XPD("", ""), "", _("^F2Shield has worn off\n"), "") \ + MSG_INFO_NOTIF(INFO_POWERDOWN_SPEED, 0, 0, NO_STR_ARG, XPD("", ""), "", _("^F2Speed has worn off\n"), "") \ + MSG_INFO_NOTIF(INFO_POWERDOWN_STRENGTH, 0, 0, NO_STR_ARG, XPD("", ""), "", _("^F2Strength has worn off\n"), "") \ + MSG_INFO_NOTIF(INFO_POWERUP_INVISIBILITY, 0, 0, NO_STR_ARG, XPD("", ""), "", _("^F2You are invisible\n"), "") \ + MSG_INFO_NOTIF(INFO_POWERUP_SHIELD, 0, 0, NO_STR_ARG, XPD("", ""), "", _("^F2Shield surrounds you\n"), "") \ + MSG_INFO_NOTIF(INFO_POWERUP_SPEED, 0, 0, NO_STR_ARG, XPD("", ""), "", _("^F2You are on speed\n"), "") \ + MSG_INFO_NOTIF(INFO_POWERUP_STRENGTH, 0, 0, NO_STR_ARG, XPD("", ""), "", _("^F2Strength infuses your weapons with devastating power\n"), "") \ + MSG_INFO_NOTIF(INFO_QUIT_DISCONNECT, 1, 0, s1, XPD(s1, ""), "", _("^BG%s^F3 disconnected\n"), "") \ + MSG_INFO_NOTIF(INFO_QUIT_KICK_IDLING, 1, 0, s1, XPD(s1, ""), "", _("^BG%s^F3 was kicked for idling\n"), "") \ + MSG_INFO_NOTIF(INFO_QUIT_KICK_SPECTATING, 0, 0, NO_STR_ARG, XPD("", ""), "", _("^F2You were kicked from the server because you are a spectator and spectators aren't allowed at the moment.\n"), "") \ + MSG_INFO_NOTIF(INFO_QUIT_SPECTATE, 1, 0, s1, XPD(s1, ""), "", _("^BG%s^F3 is now spectating\n"), "") \ MSG_INFO_NOTIF(INFO_RACE_FAIL, 2, 0, XPD(s1, s2), XPD(s1, ""), "race_newfail", "", "") \ MSG_INFO_NOTIF(INFO_RACE_NEW_RECORD, 2, 0, XPD(s1, s2), XPD(s1, ""), "race_newrecordserver", "", "") \ MSG_INFO_NOTIF(INFO_RACE_NEW_TIME, 2, 0, XPD(s1, s2), XPD(s1, ""), "race_newtime", "", "") \ MSG_INFO_NOTIF(INFO_RACE_NEW_RANK, 2, 0, XPD(s1, s2), XPD(s1, ""), "race_newrankyellow", "", "") \ MULTITEAM_INFO(INFO_SCORES_, 4, 0, 0, NO_STR_ARG, XPD("", ""), "", _("^TC^TT ^BGteam scores!\n"), "") \ + MSG_INFO_NOTIF(INFO_SPECTATE_WARNING, 0, 1, f1, XPD("", ""), "", _("^F2You have to become a player within the next %d seconds, otherwise you will be kicked, because spectating isn't allowed at this time!\n"), "") \ + MSG_INFO_NOTIF(INFO_SUPERWEAPON_BROKEN, 0, 0, NO_STR_ARG, XPD("", ""), "", _("^F2Superweapons have broken down\n"), "") \ + MSG_INFO_NOTIF(INFO_SUPERWEAPON_PICKUP, 0, 0, NO_STR_ARG, XPD("", ""), "", _("^F2You now have a superweapon\n"), "") \ + MSG_INFO_NOTIF(INFO_SUPERWEAPON_LOST, 0, 0, NO_STR_ARG, XPD("", ""), "", _("^F2Superweapons have been lost\n"), "") \ + MSG_INFO_NOTIF(INFO_VERSION_BETA, 2, 0, XPD(s1, s2), XPD("", ""), "", _("\{1}^F4NOTE: ^BGThe server is running ^F1Xonotic %s (beta)^BG, you have ^F2Xonotic %s\n"), "") \ + MSG_INFO_NOTIF(INFO_VERSION_OLD, 2, 0, XPD(s1, s2), XPD("", ""), "", _("\{1}^F4NOTE: ^BGThe server is running ^F1Xonotic %s^BG, you have ^F2Xonotic %s\n"), "") \ + MSG_INFO_NOTIF(INFO_VERSION_OUTDATED, 2, 0, XPD(s1, s2), XPD("", ""), "", _("\{1}^F4NOTE: ^F1Xonotic %s^BG is out, and you still have ^F2Xonotic %s^BG - get the update from ^F3http://www.xonotic.org/^BG!\n"), "") \ + MSG_INFO_NOTIF(INFO_WATERMARK, 1, 0, s1, XPD("", ""), "", _("^F4SVQC Build information: ^BG%s\n"), "") \ MSG_INFO_NOTIF(INFO_WEAPON_THINKING_WITH_PORTALS, 1, 1, XPD(s1, SPREE_LOST), XPD(s1, ""), "notify_selfkill", _("^BG%s^K1 is now thinking with portals%s\n"), "") \ MSG_INFO_NOTIF(INFO_WEAPON_CRYLINK_SUICIDE, 1, 1, XPD(s1, SPREE_LOST), XPD(s1, ""), "weaponcrylink", _("^BG%s^K1 felt the strong pull of their Crylink%s\n"), "") \ MSG_INFO_NOTIF(INFO_WEAPON_CRYLINK_MURDER, 2, 1, XPD(s1, s2, SPREE_END), XPD(s2, s1), "weaponcrylink", _("^BG%s^K1 felt the strong pull of ^BG%s^K1's Crylink%s\n"), "") \ @@ -359,6 +385,8 @@ void Send_CSQC_Centerprint_Generic_Expire(entity e, float id); #endif #define MSG_CENTER_NOTIFICATIONS \ MSG_CENTER_NOTIF(CENTER_EMPTY, 0, 0, NO_STR_ARG, NO_CPID, XPD(0, 0), "", "") \ + MSG_CENTER_NOTIF(CENTER_ASSAULT_ATTACKING, 0, 0, NO_STR_ARG, CPID_ASSAULT_ROLE, XPD(0, 0), _("^BGYou are attacking!"), "") \ + MSG_CENTER_NOTIF(CENTER_ASSAULT_DEFENDING, 0, 0, NO_STR_ARG, CPID_ASSAULT_ROLE, XPD(0, 0), _("^BGYou are defending!"), "") \ MSG_CENTER_NOTIF(CENTER_CTF_CAPTURESHIELD_SHIELDED, 0, 0, NO_STR_ARG, CPID_CTF_CAPSHIELD, XPD(0, 0), _("^BGYou are now ^F1shielded^BG from the flag\n^BGfor ^F2too many unsuccessful attempts^BG to capture.\n^BGMake some defensive scores before trying again."), "") \ MSG_CENTER_NOTIF(CENTER_CTF_CAPTURESHIELD_FREE, 0, 0, NO_STR_ARG, CPID_CTF_CAPSHIELD, XPD(0, 0), _("^BGYou are now free.\n^BGFeel free to ^F2try to capture^BG the flag again\n^BGif you think you will succeed."), "") \ MULTITEAM_CENTER(CENTER_CTF_PASS_OTHER_, 2, 2, 0, XPD(s1, s2), CPID_CTF_PASS, XPD(0, 0), _("^BG%s^BG passed the ^TC^TT^BG flag to %s"), "") \ @@ -413,6 +441,7 @@ void Send_CSQC_Centerprint_Generic_Expire(entity e, float id); MSG_CENTER_NOTIF(CENTER_DEATH_MURDER_TYPEFRAGGED_FIRST_VERBOSE, 1, 3, s1, NO_CPID, XPD(0, 0), _("^K1First victim! You were typefragged by ^BG%s"), _("^K1First casualty! You were scored against by ^BG%s^K1 while typing!")) \ MSG_CENTER_NOTIF(CENTER_DEATH_TEAMKILL_FRAG, 1, 0, s1, NO_CPID, XPD(0, 0), _("^K1Moron! You fragged ^BG%s^K1, a team mate!"), _("^K1Moron! You went against ^BG%sK1, a team mate!")) \ MSG_CENTER_NOTIF(CENTER_DEATH_TEAMKILL_FRAGGED, 1, 0, s1, NO_CPID, XPD(0, 0), _("^K1You were fragged by ^BG%s^K1, a team mate"), _("^K1You were scored against by ^BG%s^K1, a team mate")) \ + MSG_CENTER_NOTIF(CENTER_DISCONNECT_IDLING, 0, 1, NO_STR_ARG, CPID_IDLING, XPD(0, f1), _("^K1Stop idling!\n^BGDisconnecting in ^COUNT..."), "") \ MULTITEAM_CENTER(CENTER_FREEZETAG_ROUND_WIN_, 4, 0, 0, NO_STR_ARG, NO_CPID, XPD(0, 0), _("^TC^TT^BG team wins the round, all other teams were frozen"), "") \ MSG_CENTER_NOTIF(CENTER_FREEZETAG_SPAWN_LATE, 0, 0, NO_STR_ARG, NO_CPID, XPD(0, 0), _("^K1You spawned after the round started, you'll spawn as frozen"), "") \ MSG_CENTER_NOTIF(CENTER_FREEZETAG_REVIVE, 1, 0, s1, NO_CPID, XPD(0, 0), _("^K3You revived ^BG%s"), "") \ @@ -423,6 +452,13 @@ void Send_CSQC_Centerprint_Generic_Expire(entity e, float id); MSG_CENTER_NOTIF(CENTER_KEEPAWAY_DROPPED, 1, 0, s1, CPID_KEEPAWAY, XPD(0, 0), _("^BG%s^BG has dropped the ball!"), "") \ MSG_CENTER_NOTIF(CENTER_KEEPAWAY_PICKUP, 1, 0, s1, CPID_KEEPAWAY, XPD(0, 0), _("^BG%s^BG has picked up the ball!"), "") \ MSG_CENTER_NOTIF(CENTER_KEEPAWAY_WARN, 0, 0, NO_STR_ARG, CPID_KA_WARN, XPD(0, 0), _("^BGKilling people while you don't have the ball gives no points!"), "") \ + MSG_CENTER_NOTIF(CENTER_LMS_CAMPCHECK, 0, 0, NO_STR_ARG, CPID_LMS_CAMP, XPD(0, 0), _("^K1Don't camp!"), "") \ + MSG_CENTER_NOTIF(CENTER_JOIN_NOSPAWNS, 0, 0, NO_STR_ARG, CPID_PREVENT_JOIN, XPD(0, 0), _("^K1No spawnpoints available!\nHope your team can fix it..."), "") \ + MSG_CENTER_NOTIF(CENTER_JOIN_PREVENT, 0, 0, NO_STR_ARG, CPID_PREVENT_JOIN, XPD(0, 0), _("^K1You may not join the game at this time.\nThe player limit reached maximum capacity."), "") \ + MULTITEAM_CENTER(CENTER_TEAMCHANGE_, 4, 0, 1, NO_STR_ARG, CPID_TEAMCHANGE, XPD(0, f1), _("^BGChanging to ^TC^TT^BG in ^COUNT"), "") \ + MSG_CENTER_NOTIF(CENTER_TEAMCHANGE_SPECTATE, 0, 1, NO_STR_ARG, CPID_TEAMCHANGE, XPD(0, f1), _("^BGSpectating in ^COUNT"), "") \ + MSG_CENTER_NOTIF(CENTER_TEAMCHANGE_AUTO, 0, 1, NO_STR_ARG, CPID_TEAMCHANGE, XPD(0, f1), _("^BGChanging team in ^COUNT"), "") \ + MSG_CENTER_NOTIF(CENTER_TEAMCHANGE_SUICIDE, 0, 1, NO_STR_ARG, CPID_TEAMCHANGE, XPD(0, f1), _("^K1Suicide in ^COUNT"), "") \ MSG_CENTER_NOTIF(CENTER_WEAPON_MARBLES_LOST, 1, 1, XPD(s1, WEAPON_NAME), NO_CPID, XPD(0, 0), _("^K1You lost your marbles against ^BG%s^K1 using the ^BG%s!"), "") #define MSG_WEAPON_NOTIFICATIONS \ diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index af9525d8e..7b603e80f 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -896,7 +896,6 @@ float autocvar_g_keyhunt_teams_override; float autocvar_g_lms_campcheck_damage; float autocvar_g_lms_campcheck_distance; float autocvar_g_lms_campcheck_interval; -string autocvar_g_lms_campcheck_message; float autocvar_g_lms_join_anytime; float autocvar_g_lms_last_join; #define autocvar_g_lms_lives_override cvar("g_lms_lives_override") diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index b2484e054..7e768741b 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -425,12 +425,12 @@ void PutObserverInServer (void) if(self.killcount != -666) { if(g_lms) { - if(PlayerScore_Add(self, SP_LMS_RANK, 0) > 0) - bprint ("^4", self.netname, "^4 has no more lives left\n"); + if(PlayerScore_Add(self, SP_LMS_RANK, 0) > 0 && self.lms_spectate_warning != 2) + Send_Notification_Legacy_Wrapper(NOTIF_ANY, world, MSG_INFO, INFO_LMS_NOLIVES, self.netname, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); else - bprint ("^4", self.netname, "^4 is spectating now\n"); // TODO turn this into a proper forfeit? + Send_Notification_Legacy_Wrapper(NOTIF_ANY, world, MSG_INFO, INFO_LMS_FORFEIT, self.netname, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); } else - bprint ("^4", self.netname, "^4 is spectating now\n"); + Send_Notification_Legacy_Wrapper(NOTIF_ANY, world, MSG_INFO, INFO_QUIT_SPECTATE, self.netname, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); if(self.just_joined == FALSE) { LogTeamchange(self.playerid, -1, 4); @@ -696,7 +696,7 @@ void PutClientInServer (void) spot = SelectSpawnPoint (FALSE); if(!spot) { - centerprint(self, "Sorry, no spawnpoints available!\nHope your team can fix it..."); + Send_Notification_Legacy_Wrapper(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_JOIN_NOSPAWNS, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); return; // spawn failed } @@ -878,9 +878,9 @@ void PutClientInServer (void) if(g_assault) { if(self.team == assault_attacker_team) - centerprint(self, "You are attacking!"); + Send_Notification_Legacy_Wrapper(NOTIF_TEAM, self, MSG_CENTER, CENTER_ASSAULT_ATTACKING, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); else - centerprint(self, "You are defending!"); + Send_Notification_Legacy_Wrapper(NOTIF_TEAM, self, MSG_CENTER, CENTER_ASSAULT_DEFENDING, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); } target_voicescript_clear(self); @@ -1083,7 +1083,7 @@ void ClientKill_Now_TeamChange() if(g_ca) self.caplayer = 0; if(blockSpectators) - sprint(self, strcat("^7You have to become a player within the next ", ftos(autocvar_g_maxplayers_spectator_blocktime), " seconds, otherwise you will be kicked, because spectators aren't allowed at this time!\n")); + Send_Notification_Legacy_Wrapper(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_SPECTATE_WARNING, NO_STR_ARG, NO_STR_ARG, autocvar_g_maxplayers_spectator_blocktime, NO_FL_ARG, NO_FL_ARG); PutObserverInServer(); } else @@ -1234,28 +1234,28 @@ void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2 self.killindicator.colormod = '0 0 0'; if(clienttype(self) == CLIENTTYPE_REAL) if(self.killindicator.cnt > 0) - Send_CSQC_Centerprint_Generic(self, CPID_TEAMCHANGE, "^1Suicide in %d seconds", 1, self.killindicator.cnt); + Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_TEAMCHANGE_SUICIDE, NO_STR_ARG, NO_STR_ARG, self.killindicator.cnt, NO_FL_ARG, NO_FL_ARG); } else if(targetteam == -1) // auto { self.killindicator.colormod = '0 1 0'; if(clienttype(self) == CLIENTTYPE_REAL) if(self.killindicator.cnt > 0) - Send_CSQC_Centerprint_Generic(self, CPID_TEAMCHANGE, "Changing team in %d seconds", 1, self.killindicator.cnt); + Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_TEAMCHANGE_AUTO, NO_STR_ARG, NO_STR_ARG, self.killindicator.cnt, NO_FL_ARG, NO_FL_ARG); } else if(targetteam == -2) // spectate { self.killindicator.colormod = '0.5 0.5 0.5'; if(clienttype(self) == CLIENTTYPE_REAL) if(self.killindicator.cnt > 0) - Send_CSQC_Centerprint_Generic(self, CPID_TEAMCHANGE, "Spectating in %d seconds", 1, self.killindicator.cnt); + Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_TEAMCHANGE_SPECTATE, NO_STR_ARG, NO_STR_ARG, self.killindicator.cnt, NO_FL_ARG, NO_FL_ARG); } else { self.killindicator.colormod = Team_ColorRGB(targetteam); if(clienttype(self) == CLIENTTYPE_REAL) if(self.killindicator.cnt > 0) - Send_CSQC_Centerprint_Generic(self, CPID_TEAMCHANGE, strcat("^7Changing to ", Team_ColoredFullName(targetteam), "^7 in %d seconds"), 1, self.killindicator.cnt); + Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, APP_TEAM_NUM_4(targetteam, CENTER_TEAMCHANGE_), NO_STR_ARG, NO_STR_ARG, self.killindicator.cnt, NO_FL_ARG, NO_FL_ARG); } } @@ -1365,7 +1365,7 @@ void ClientConnect (void) DecodeLevelParms(); #ifdef WATERMARK - sprint(self, strcat("^4SVQC Build information: ^1", WATERMARK, "\n")); + Send_Notification_Legacy_Wrapper(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_WATERMARK, WATERMARK, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); #endif self.classname = "player_joining"; @@ -1483,12 +1483,10 @@ void ClientConnect (void) self.netname_previous = strzone(self.netname); - bprint("^4", self.netname, "^4 connected"); - - if(self.classname != "observer" && (g_domination || g_ctf)) - bprint(" and joined the ", Team_ColoredFullName(self.team)); - - bprint("\n"); + if((self.classname == STR_PLAYER && teamplay)) + Send_Notification_Legacy_Wrapper(NOTIF_ANY, world, MSG_INFO, APP_TEAM_ENT_4(self, INFO_JOIN_CONNECT_TEAM_), self.netname, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); + else + Send_Notification_Legacy_Wrapper(NOTIF_ANY, world, MSG_INFO, INFO_JOIN_CONNECT, self.netname, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); stuffcmd(self, strcat(clientstuff, "\n")); stuffcmd(self, "cl_particles_reloadeffects\n"); // TODO do we still need this? @@ -1531,7 +1529,7 @@ void ClientConnect (void) self.spectatortime = time; if(blockSpectators) { - sprint(self, strcat("^7You have to become a player within the next ", ftos(autocvar_g_maxplayers_spectator_blocktime), " seconds, otherwise you will be kicked, because spectators aren't allowed at this time!\n")); + Send_Notification_Legacy_Wrapper(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_SPECTATE_WARNING, NO_STR_ARG, NO_STR_ARG, autocvar_g_maxplayers_spectator_blocktime, NO_FL_ARG, NO_FL_ARG); } self.jointime = time; @@ -1644,8 +1642,8 @@ void ClientDisconnect (void) if(autocvar_sv_eventlog) GameLogEcho(strcat(":part:", ftos(self.playerid))); - bprint ("^4",self.netname); - bprint ("^4 disconnected\n"); + + Send_Notification_Legacy_Wrapper(NOTIF_ANY, world, MSG_INFO, INFO_QUIT_DISCONNECT, self.netname, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); DropAllRunes(self); MUTATOR_CALLHOOK(ClientDisconnect); @@ -1816,7 +1814,7 @@ void player_powerups (void) self.alpha = default_player_alpha; self.exteriorweaponentity.alpha = default_weapon_alpha; self.items &~= IT_STRENGTH; - sprint(self, "^3Invisibility has worn off\n"); + Send_Notification_Legacy_Wrapper(NOTIF_ONE, self, MSG_INFO, INFO_POWERDOWN_INVISIBILITY, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); } } else @@ -1826,7 +1824,7 @@ void player_powerups (void) self.alpha = g_minstagib_invis_alpha; self.exteriorweaponentity.alpha = g_minstagib_invis_alpha; self.items |= IT_STRENGTH; - sprint(self, "^3You are invisible\n"); + Send_Notification_Legacy_Wrapper(NOTIF_ONE, self, MSG_INFO, INFO_POWERUP_INVISIBILITY, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); } } @@ -1836,7 +1834,7 @@ void player_powerups (void) if (time > self.invincible_finished) { self.items = self.items - (self.items & IT_INVINCIBLE); - sprint(self, "^3Speed has worn off\n"); + Send_Notification_Legacy_Wrapper(NOTIF_ONE, self, MSG_INFO, INFO_POWERDOWN_SPEED, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); } } else @@ -1844,7 +1842,7 @@ void player_powerups (void) if (time < self.invincible_finished) { self.items = self.items | IT_INVINCIBLE; - sprint(self, "^3You are on speed\n"); + Send_Notification_Legacy_Wrapper(NOTIF_ONE, self, MSG_INFO, INFO_POWERUP_SPEED, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); } } } @@ -1857,7 +1855,7 @@ void player_powerups (void) if (time > self.strength_finished) { self.items = self.items - (self.items & IT_STRENGTH); - sprint(self, "^3Strength has worn off\n"); + Send_Notification_Legacy_Wrapper(NOTIF_ONE, self, MSG_INFO, INFO_POWERDOWN_STRENGTH, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); } } else @@ -1865,7 +1863,7 @@ void player_powerups (void) if (time < self.strength_finished) { self.items = self.items | IT_STRENGTH; - sprint(self, "^3Strength infuses your weapons with devastating power\n"); + Send_Notification_Legacy_Wrapper(NOTIF_ONE, self, MSG_INFO, INFO_POWERUP_STRENGTH, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); } } if (self.items & IT_INVINCIBLE) @@ -1875,7 +1873,7 @@ void player_powerups (void) if (time > self.invincible_finished) { self.items = self.items - (self.items & IT_INVINCIBLE); - sprint(self, "^3Shield has worn off\n"); + Send_Notification_Legacy_Wrapper(NOTIF_ONE, self, MSG_INFO, INFO_POWERDOWN_SHIELD, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); } } else @@ -1883,7 +1881,7 @@ void player_powerups (void) if (time < self.invincible_finished) { self.items = self.items | IT_INVINCIBLE; - sprint(self, "^3Shield surrounds you\n"); + Send_Notification_Legacy_Wrapper(NOTIF_ONE, self, MSG_INFO, INFO_POWERUP_SHIELD, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); } } if (self.items & IT_SUPERWEAPON) @@ -1892,7 +1890,7 @@ void player_powerups (void) { self.superweapons_finished = 0; self.items = self.items - (self.items & IT_SUPERWEAPON); - sprint(self, "^3Superweapons have been lost\n"); + Send_Notification_Legacy_Wrapper(NOTIF_ONE, self, MSG_INFO, INFO_SUPERWEAPON_LOST, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); } else if (self.items & IT_UNLIMITED_SUPERWEAPONS) { @@ -1905,7 +1903,7 @@ void player_powerups (void) { self.items = self.items - (self.items & IT_SUPERWEAPON); WEPSET_ANDNOT_EA(self, WEPBIT_SUPERWEAPONS); - sprint(self, "^3Superweapons have broken down\n"); + Send_Notification_Legacy_Wrapper(NOTIF_ONE, self, MSG_INFO, INFO_SUPERWEAPON_BROKEN, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); } } } @@ -1914,7 +1912,7 @@ void player_powerups (void) if (time < self.superweapons_finished || (self.items & IT_UNLIMITED_SUPERWEAPONS)) { self.items = self.items | IT_SUPERWEAPON; - sprint(self, "^3You now have a superweapon\n"); + Send_Notification_Legacy_Wrapper(NOTIF_ONE, self, MSG_INFO, INFO_SUPERWEAPON_PICKUP, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); } else { @@ -2335,8 +2333,8 @@ void LeaveSpectatorMode() PutClientInServer(); - if(self.classname == "player") - bprint ("^4", self.netname, "^4 is playing now\n"); + if(self.classname == STR_PLAYER) + Send_Notification_Legacy_Wrapper(NOTIF_ANY, world, MSG_INFO, INFO_JOIN_PLAY, self.netname, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); if(!autocvar_g_campaign) if (time < self.jointime + autocvar_welcome_message_time) @@ -2344,7 +2342,7 @@ void LeaveSpectatorMode() if (self.prevent_join_msgtime) { - Send_CSQC_Centerprint_Generic_Expire(self, CPID_PREVENT_JOIN); + Send_Notification_Legacy_Wrapper(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_JOIN_PREVENT, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); self.prevent_join_msgtime = 0; } @@ -2414,7 +2412,7 @@ float nJoinAllowed(entity ignore) { void checkSpectatorBlock() { if(self.classname == "spectator" || self.classname == "observer") { if( time > (self.spectatortime + autocvar_g_maxplayers_spectator_blocktime) ) { - sprint(self, "^7You were kicked from the server because you are spectator and spectators aren't allowed at the moment.\n"); + Send_Notification_Legacy_Wrapper(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_QUIT_KICK_SPECTATING, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); dropclient(self); } } @@ -2601,7 +2599,7 @@ void PlayerPreThink (void) { // notify release users if connecting to git dprint("^1NOTE^7 to ", self.netname, "^7 - the server is running ^3Xonotic ", autocvar_g_xonoticversion, " (beta)^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n"); - sprint(self, strcat("\{1}^1NOTE: ^7the server is running ^3Xonotic ", autocvar_g_xonoticversion, " (beta)^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n")); + Send_Notification_Legacy_Wrapper(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_VERSION_BETA, autocvar_g_xonoticversion, self.cvar_g_xonoticversion, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); } else { @@ -2611,13 +2609,13 @@ void PlayerPreThink (void) { // give users new version dprint("^1NOTE^7 to ", self.netname, "^7 - ^3Xonotic ", autocvar_g_xonoticversion, "^7 is out, and you still have ^3Xonotic ", self.cvar_g_xonoticversion, "^1 - get the update from ^4http://www.xonotic.org/^1!\n"); - sprint(self, strcat("\{1}^1NOTE: ^3Xonotic ", autocvar_g_xonoticversion, "^7 is out, and you still have ^3Xonotic ", self.cvar_g_xonoticversion, "^1 - get the update from ^4http://www.xonotic.org/^1!\n")); + Send_Notification_Legacy_Wrapper(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_VERSION_OUTDATED, autocvar_g_xonoticversion, self.cvar_g_xonoticversion, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); } else if(r > 0) { // notify users about old server version print("^1NOTE^7 to ", self.netname, "^7 - the server is running ^3Xonotic ", autocvar_g_xonoticversion, "^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n"); - sprint(self, strcat("\{1}^1NOTE: ^7the server is running ^3Xonotic ", autocvar_g_xonoticversion, "^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n")); + Send_Notification_Legacy_Wrapper(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_VERSION_OLD, autocvar_g_xonoticversion, self.cvar_g_xonoticversion, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); } } } @@ -2627,7 +2625,7 @@ void PlayerPreThink (void) // GOD MODE info if(!(self.flags & FL_GODMODE)) if(self.max_armorvalue) { - sprint(self, strcat("godmode saved you ", ftos(self.max_armorvalue), " units of damage, cheater!\n")); + Send_Notification_Legacy_Wrapper(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_GODMODE_OFF, NO_STR_ARG, NO_STR_ARG, self.max_armorvalue, NO_FL_ARG, NO_FL_ARG); self.max_armorvalue = 0; } @@ -2787,7 +2785,7 @@ void PlayerPreThink (void) //sprint(self, "distance: ", ftos(self.lms_traveled_distance), "\n"); if(self.lms_traveled_distance < autocvar_g_lms_campcheck_distance) { - centerprint(self, autocvar_g_lms_campcheck_message); + Send_Notification_Legacy_Wrapper(NOTIF_ONE, self, MSG_CENTER, CENTER_LMS_CAMPCHECK, NO_STR_ARG, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); // FIXME KadaverJack: gibbing player here causes playermodel to bounce around, instead of eye.md3 // I wasn't able to find out WHY that happens, so I put a workaround in place that shall prevent players from being gibbed :( Damage(self, self, self, bound(0, autocvar_g_lms_campcheck_damage, self.health + self.armorvalue * autocvar_g_balance_armor_blockpercent + 5), DEATH_CAMP, self.origin, '0 0 0'); @@ -2987,11 +2985,7 @@ void PlayerPostThink (void) { if (time - self.parm_idlesince < 1) // instead of (time == self.parm_idlesince) to support sv_maxidle <= 10 { - if(self.idlekick_lasttimeleft) - { - Send_CSQC_Centerprint_Generic_Expire(self, CPID_DISCONNECT_IDLING); - self.idlekick_lasttimeleft = 0; - } + if(self.idlekick_lasttimeleft) { self.idlekick_lasttimeleft = 0; } } else { @@ -3000,12 +2994,11 @@ void PlayerPostThink (void) if(timeleft == min(10, sv_maxidle - 1)) // - 1 to support sv_maxidle <= 10 { if(!self.idlekick_lasttimeleft) - Send_CSQC_Centerprint_Generic(self, CPID_DISCONNECT_IDLING, "^3Stop idling!\n^3Disconnecting in %d seconds...", 1, timeleft); + Send_Notification_Legacy_Wrapper(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_DISCONNECT_IDLING, NO_STR_ARG, NO_STR_ARG, timeleft, NO_FL_ARG, NO_FL_ARG); } if(timeleft <= 0) { - bprint("^3", self.netname, "^3 was kicked for idling.\n"); - AnnounceTo(self, "terminated"); + Send_Notification_Legacy_Wrapper(NOTIF_ANY, world, MSG_INFO, INFO_QUIT_KICK_IDLING, self.netname, NO_STR_ARG, NO_FL_ARG, NO_FL_ARG, NO_FL_ARG); dropclient(self); return; } diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index eba74cd38..2b52d0f7b 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -397,6 +397,8 @@ void ClientCommand_spectate(float request) { if(self.lms_spectate_warning) { + // for the forfeit message... + self.lms_spectate_warning = 2; // mark player as spectator PlayerScore_Add(self, SP_LMS_RANK, 666 - PlayerScore_Add(self, SP_LMS_RANK, 0)); } diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index c14d07bbf..4cd73e175 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -1108,7 +1108,7 @@ void GameCommand_nospectators(float request) if(plr.classname == "spectator" || plr.classname == "observer") { plr.spectatortime = time; - sprint(plr, strcat("^7You have to become a player within the next ", ftos(autocvar_g_maxplayers_spectator_blocktime), " seconds, otherwise you will be kicked, because spectators aren't allowed at this time!\n")); + Send_Notification_Legacy_Wrapper(NOTIF_ONE_ONLY, plr, MSG_INFO, INFO_SPECTATE_WARNING, NO_STR_ARG, NO_STR_ARG, autocvar_g_maxplayers_spectator_blocktime, NO_FL_ARG, NO_FL_ARG); } } bprint(strcat("^7All spectators will be automatically kicked when not joining the game after ", ftos(autocvar_g_maxplayers_spectator_blocktime), " seconds!\n")); -- 2.39.2