From e18524ec011a7d02c516933a5ed9974c960ade04 Mon Sep 17 00:00:00 2001 From: oy Date: Sun, 24 Mar 2019 14:18:48 +0100 Subject: [PATCH] show message who initiated the pause. closes #2051 --- datasrc/network.py | 6 ++++-- scripts/cmd5.py | 2 +- src/game/client/gameclient.cpp | 11 +++++++++++ src/game/server/gamecontroller.cpp | 3 +++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/datasrc/network.py b/datasrc/network.py index 34b3e37af..58752851f 100644 --- a/datasrc/network.py +++ b/datasrc/network.py @@ -3,7 +3,7 @@ from datatypes import * Pickups = Enum("PICKUP", ["HEALTH", "ARMOR", "GRENADE", "SHOTGUN", "LASER", "NINJA"]) Emotes = Enum("EMOTE", ["NORMAL", "PAIN", "HAPPY", "SURPRISE", "ANGRY", "BLINK"]) Emoticons = Enum("EMOTICON", ["OOP", "EXCLAMATION", "HEARTS", "DROP", "DOTDOT", "MUSIC", "SORRY", "GHOST", "SUSHI", "SPLATTEE", "DEVILTEE", "ZOMG", "ZZZ", "WTF", "EYES", "QUESTION"]) -Votes = Enum("VOTE", ["UNKNOWN", "START_OP", "START_KICK", "START_SPEC", "END_ABORT", "END_PASS", "END_FAIL"]) # todo: add RUN_OP, RUN_KICK, RUN_SPEC; rem UNKNOWN +Votes = Enum("VOTE", ["UNKNOWN", "START_OP", "START_KICK", "START_SPEC", "END_ABORT", "END_PASS", "END_FAIL"]) # todo 0.8: add RUN_OP, RUN_KICK, RUN_SPEC; rem UNKNOWN ChatModes = Enum("CHAT", ["NONE", "ALL", "TEAM", "WHISPER"]) PlayerFlags = Flags("PLAYERFLAG", ["ADMIN", "CHATTING", "SCOREBOARD", "READY", "DEAD", "WATCHING", "BOT"]) @@ -15,7 +15,9 @@ GameMsgIDs = Enum("GAMEMSG", ["TEAM_SWAP", "SPEC_INVALIDID", "TEAM_SHUFFLE", "TE "TEAM_ALL", "TEAM_BALANCE_VICTIM", "CTF_GRAB", - "CTF_CAPTURE"]) + "CTF_CAPTURE", + + "GAME_PAUSED"]) # todo 0.8: sort (1 para) RawHeader = ''' diff --git a/scripts/cmd5.py b/scripts/cmd5.py index a46a6fed8..6f879470d 100644 --- a/scripts/cmd5.py +++ b/scripts/cmd5.py @@ -30,6 +30,6 @@ for filename in sys.argv[1:]: hash = hashlib.md5(f).hexdigest().lower()[16:] #TODO 0.8: improve nethash creation -if hash == "1e78cc961fc904e5": +if hash == "7dc99529e56a8ded": hash = "802f1be60a05665f" print('#define GAME_NETVERSION_HASH "%s"' % hash) diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index b14919d86..200fe5446 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -158,6 +158,8 @@ static CGameMsg gs_GameMsgList[NUM_GAMEMSGS] = { {/*GAMEMSG_CTF_GRAB*/ DO_SPECIAL, PARA_I, ""}, // special - play ctf grab sound based on team {/*GAMEMSG_CTF_CAPTURE*/ DO_SPECIAL, PARA_III, ""}, // special - play ctf capture sound + capture chat message + + {/*GAMEMSG_GAME_PAUSED*/ DO_SPECIAL, PARA_I, ""}, // special - add player name }; void CGameClient::OnConsoleInit() @@ -622,6 +624,15 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker) else m_pSounds->Enqueue(CSounds::CHN_GLOBAL, SOUND_CTF_GRAB_EN); break; + case GAMEMSG_GAME_PAUSED: + { + int ClientID = clamp(aParaI[0], 0, MAX_CLIENTS - 1); + char aLabel[64]; + GetPlayerLabel(aLabel, sizeof(aLabel), ClientID, m_aClients[ClientID].m_aName); + str_format(aBuf, sizeof(aBuf), Localize("'%s' initiated a pause"), aLabel); + m_pChat->AddLine(-1, 0, aBuf); + } + break; case GAMEMSG_CTF_CAPTURE: m_pSounds->Enqueue(CSounds::CHN_GLOBAL, SOUND_CTF_CAPTURE); int ClientID = clamp(aParaI[1], 0, MAX_CLIENTS - 1); diff --git a/src/game/server/gamecontroller.cpp b/src/game/server/gamecontroller.cpp index 6be15c34b..44650fa26 100644 --- a/src/game/server/gamecontroller.cpp +++ b/src/game/server/gamecontroller.cpp @@ -372,7 +372,10 @@ void IGameController::OnPlayerReadyChange(CPlayer *pPlayer) pPlayer->m_IsReadyToPlay ^= 1; if(m_GameState == IGS_GAME_RUNNING && !pPlayer->m_IsReadyToPlay) + { SetGameState(IGS_GAME_PAUSED, TIMER_INFINITE); // one player isn't ready -> pause the game + GameServer()->SendGameMsg(GAMEMSG_GAME_PAUSED, pPlayer->GetCID(), -1); + } CheckReadyStates(); }