mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-19 17:14:18 +00:00
Replace remaining non-extended extension messages
Add backward compatibility stuff, but this allows newer clients to only care for new messages.
This commit is contained in:
parent
0d916e2ef6
commit
9784726683
|
@ -406,15 +406,15 @@ Messages = [
|
|||
NetStringStrict("m_Reason"),
|
||||
], teehistorian=False),
|
||||
|
||||
NetMessage("Cl_IsDDNet", []),
|
||||
NetMessage("Cl_IsDDNetLegacy", []),
|
||||
|
||||
NetMessage("Sv_DDRaceTime", [
|
||||
NetMessage("Sv_DDRaceTimeLegacy", [
|
||||
NetIntAny("m_Time"),
|
||||
NetIntAny("m_Check"),
|
||||
NetIntRange("m_Finish", 0, 1),
|
||||
]),
|
||||
|
||||
NetMessage("Sv_Record", [
|
||||
NetMessage("Sv_RecordLegacy", [
|
||||
NetIntAny("m_ServerTimeBest"),
|
||||
NetIntAny("m_PlayerTimeBest"),
|
||||
]),
|
||||
|
@ -443,4 +443,15 @@ Messages = [
|
|||
]),
|
||||
|
||||
NetMessageEx("Sv_TeamsState", "teamsstate@netmsg.ddnet.tw", []),
|
||||
|
||||
NetMessageEx("Sv_DDRaceTime", "ddrace-time@netmsg.ddnet.tw", [
|
||||
NetIntAny("m_Time"),
|
||||
NetIntAny("m_Check"),
|
||||
NetIntRange("m_Finish", 0, 1),
|
||||
]),
|
||||
|
||||
NetMessageEx("Sv_Record", "weird-record@netmsg.ddnet.tw", [
|
||||
NetIntAny("m_ServerTimeBest"),
|
||||
NetIntAny("m_PlayerTimeBest"),
|
||||
]),
|
||||
]
|
||||
|
|
|
@ -114,7 +114,7 @@ enum
|
|||
VERSION_DDNET_FIREDELAY_TUNE = 701,
|
||||
VERSION_DDNET_UPDATER_FIXED = 707,
|
||||
VERSION_DDNET_GAMETICK = 10042,
|
||||
VERSION_DDNET_TEAMSSTATE_LEGACY = 15025,
|
||||
VERSION_DDNET_MSG_LEGACY = 15025,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -859,7 +859,7 @@ void CHud::OnRender()
|
|||
|
||||
void CHud::OnMessage(int MsgType, void *pRawMsg)
|
||||
{
|
||||
if(MsgType == NETMSGTYPE_SV_DDRACETIME)
|
||||
if(MsgType == NETMSGTYPE_SV_DDRACETIME || MsgType == NETMSGTYPE_SV_DDRACETIMELEGACY)
|
||||
{
|
||||
m_DDRaceTimeReceived = true;
|
||||
|
||||
|
@ -877,7 +877,7 @@ void CHud::OnMessage(int MsgType, void *pRawMsg)
|
|||
m_CheckpointTick = Client()->GameTick(g_Config.m_ClDummy);
|
||||
}
|
||||
}
|
||||
else if(MsgType == NETMSGTYPE_SV_RECORD)
|
||||
else if(MsgType == NETMSGTYPE_SV_RECORD || MsgType == NETMSGTYPE_SV_RECORDLEGACY)
|
||||
{
|
||||
CNetMsg_Sv_Record *pMsg = (CNetMsg_Sv_Record *)pRawMsg;
|
||||
|
||||
|
|
|
@ -1611,7 +1611,7 @@ void CGameClient::OnNewSnapshot()
|
|||
|
||||
if(!m_DDRaceMsgSent[0] && m_Snap.m_pLocalInfo)
|
||||
{
|
||||
CMsgPacker Msg(NETMSGTYPE_CL_ISDDNET, false);
|
||||
CMsgPacker Msg(NETMSGTYPE_CL_ISDDNETLEGACY, false);
|
||||
Msg.AddInt(CLIENT_VERSIONNR);
|
||||
Client()->SendMsgY(&Msg, MSGFLAG_VITAL, 0);
|
||||
m_DDRaceMsgSent[0] = true;
|
||||
|
@ -1619,7 +1619,7 @@ void CGameClient::OnNewSnapshot()
|
|||
|
||||
if(!m_DDRaceMsgSent[1] && m_Snap.m_pLocalInfo && Client()->DummyConnected())
|
||||
{
|
||||
CMsgPacker Msg(NETMSGTYPE_CL_ISDDNET, false);
|
||||
CMsgPacker Msg(NETMSGTYPE_CL_ISDDNETLEGACY, false);
|
||||
Msg.AddInt(CLIENT_VERSIONNR);
|
||||
Client()->SendMsgY(&Msg, MSGFLAG_VITAL, 1);
|
||||
m_DDRaceMsgSent[1] = true;
|
||||
|
|
|
@ -2123,7 +2123,7 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
|
|||
SendBroadcast(aBuf, ClientID);
|
||||
}
|
||||
}
|
||||
else if(MsgID == NETMSGTYPE_CL_ISDDNET)
|
||||
else if(MsgID == NETMSGTYPE_CL_ISDDNETLEGACY)
|
||||
{
|
||||
IServer::CClientInfo Info;
|
||||
Server()->GetClientInfo(ClientID, &Info);
|
||||
|
|
|
@ -440,7 +440,7 @@ void CGameTeams::SendTeamsState(int ClientID)
|
|||
|
||||
Server()->SendMsg(&Msg, MSGFLAG_VITAL, ClientID);
|
||||
int ClientVersion = m_pGameContext->m_apPlayers[ClientID]->GetClientVersion();
|
||||
if(!Server()->IsSixup(ClientID) && VERSION_DDRACE < ClientVersion && ClientVersion <= VERSION_DDNET_TEAMSSTATE_LEGACY)
|
||||
if(!Server()->IsSixup(ClientID) && VERSION_DDRACE < ClientVersion && ClientVersion <= VERSION_DDNET_MSG_LEGACY)
|
||||
{
|
||||
Server()->SendMsg(&MsgLegacy, MSGFLAG_VITAL, ClientID);
|
||||
}
|
||||
|
@ -641,20 +641,24 @@ void CGameTeams::OnFinish(CPlayer *Player, float Time, const char *pTimestamp)
|
|||
}
|
||||
}
|
||||
|
||||
if(Player->GetClientVersion() >= VERSION_DDRACE)
|
||||
{
|
||||
CNetMsg_Sv_DDRaceTime Msg;
|
||||
Msg.m_Time = (int)(Time * 100.0f);
|
||||
Msg.m_Check = 0;
|
||||
Msg.m_Finish = 1;
|
||||
CNetMsg_Sv_DDRaceTimeLegacy MsgLegacy;
|
||||
MsgLegacy.m_Time = Msg.m_Time = (int)(Time * 100.0f);
|
||||
MsgLegacy.m_Check = Msg.m_Check = 0;
|
||||
MsgLegacy.m_Finish = Msg.m_Finish = 1;
|
||||
|
||||
if(pData->m_BestTime)
|
||||
{
|
||||
float Diff = (Time - pData->m_BestTime) * 100;
|
||||
Msg.m_Check = (int)Diff;
|
||||
MsgLegacy.m_Check = Msg.m_Check = (int)Diff;
|
||||
}
|
||||
|
||||
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, ClientID);
|
||||
if(!Server()->IsSixup(ClientID) && VERSION_DDRACE <= Player->GetClientVersion() && Player->GetClientVersion() <= VERSION_DDNET_MSG_LEGACY)
|
||||
{
|
||||
Server()->SendPackMsg(&MsgLegacy, MSGFLAG_VITAL, ClientID);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue