show message who initiated the pause. closes #2051

This commit is contained in:
oy 2019-03-24 14:18:48 +01:00
parent cf8212a663
commit e18524ec01
4 changed files with 19 additions and 3 deletions

View file

@ -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 = '''

View file

@ -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)

View file

@ -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);

View file

@ -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();
}