mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +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"),
|
NetStringStrict("m_Reason"),
|
||||||
], teehistorian=False),
|
], teehistorian=False),
|
||||||
|
|
||||||
NetMessage("Cl_IsDDNet", []),
|
NetMessage("Cl_IsDDNetLegacy", []),
|
||||||
|
|
||||||
NetMessage("Sv_DDRaceTime", [
|
NetMessage("Sv_DDRaceTimeLegacy", [
|
||||||
NetIntAny("m_Time"),
|
NetIntAny("m_Time"),
|
||||||
NetIntAny("m_Check"),
|
NetIntAny("m_Check"),
|
||||||
NetIntRange("m_Finish", 0, 1),
|
NetIntRange("m_Finish", 0, 1),
|
||||||
]),
|
]),
|
||||||
|
|
||||||
NetMessage("Sv_Record", [
|
NetMessage("Sv_RecordLegacy", [
|
||||||
NetIntAny("m_ServerTimeBest"),
|
NetIntAny("m_ServerTimeBest"),
|
||||||
NetIntAny("m_PlayerTimeBest"),
|
NetIntAny("m_PlayerTimeBest"),
|
||||||
]),
|
]),
|
||||||
|
@ -443,4 +443,15 @@ Messages = [
|
||||||
]),
|
]),
|
||||||
|
|
||||||
NetMessageEx("Sv_TeamsState", "teamsstate@netmsg.ddnet.tw", []),
|
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_FIREDELAY_TUNE = 701,
|
||||||
VERSION_DDNET_UPDATER_FIXED = 707,
|
VERSION_DDNET_UPDATER_FIXED = 707,
|
||||||
VERSION_DDNET_GAMETICK = 10042,
|
VERSION_DDNET_GAMETICK = 10042,
|
||||||
VERSION_DDNET_TEAMSSTATE_LEGACY = 15025,
|
VERSION_DDNET_MSG_LEGACY = 15025,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -859,7 +859,7 @@ void CHud::OnRender()
|
||||||
|
|
||||||
void CHud::OnMessage(int MsgType, void *pRawMsg)
|
void CHud::OnMessage(int MsgType, void *pRawMsg)
|
||||||
{
|
{
|
||||||
if(MsgType == NETMSGTYPE_SV_DDRACETIME)
|
if(MsgType == NETMSGTYPE_SV_DDRACETIME || MsgType == NETMSGTYPE_SV_DDRACETIMELEGACY)
|
||||||
{
|
{
|
||||||
m_DDRaceTimeReceived = true;
|
m_DDRaceTimeReceived = true;
|
||||||
|
|
||||||
|
@ -877,7 +877,7 @@ void CHud::OnMessage(int MsgType, void *pRawMsg)
|
||||||
m_CheckpointTick = Client()->GameTick(g_Config.m_ClDummy);
|
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;
|
CNetMsg_Sv_Record *pMsg = (CNetMsg_Sv_Record *)pRawMsg;
|
||||||
|
|
||||||
|
|
|
@ -1611,7 +1611,7 @@ void CGameClient::OnNewSnapshot()
|
||||||
|
|
||||||
if(!m_DDRaceMsgSent[0] && m_Snap.m_pLocalInfo)
|
if(!m_DDRaceMsgSent[0] && m_Snap.m_pLocalInfo)
|
||||||
{
|
{
|
||||||
CMsgPacker Msg(NETMSGTYPE_CL_ISDDNET, false);
|
CMsgPacker Msg(NETMSGTYPE_CL_ISDDNETLEGACY, false);
|
||||||
Msg.AddInt(CLIENT_VERSIONNR);
|
Msg.AddInt(CLIENT_VERSIONNR);
|
||||||
Client()->SendMsgY(&Msg, MSGFLAG_VITAL, 0);
|
Client()->SendMsgY(&Msg, MSGFLAG_VITAL, 0);
|
||||||
m_DDRaceMsgSent[0] = true;
|
m_DDRaceMsgSent[0] = true;
|
||||||
|
@ -1619,7 +1619,7 @@ void CGameClient::OnNewSnapshot()
|
||||||
|
|
||||||
if(!m_DDRaceMsgSent[1] && m_Snap.m_pLocalInfo && Client()->DummyConnected())
|
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);
|
Msg.AddInt(CLIENT_VERSIONNR);
|
||||||
Client()->SendMsgY(&Msg, MSGFLAG_VITAL, 1);
|
Client()->SendMsgY(&Msg, MSGFLAG_VITAL, 1);
|
||||||
m_DDRaceMsgSent[1] = true;
|
m_DDRaceMsgSent[1] = true;
|
||||||
|
|
|
@ -2123,7 +2123,7 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
|
||||||
SendBroadcast(aBuf, ClientID);
|
SendBroadcast(aBuf, ClientID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(MsgID == NETMSGTYPE_CL_ISDDNET)
|
else if(MsgID == NETMSGTYPE_CL_ISDDNETLEGACY)
|
||||||
{
|
{
|
||||||
IServer::CClientInfo Info;
|
IServer::CClientInfo Info;
|
||||||
Server()->GetClientInfo(ClientID, &Info);
|
Server()->GetClientInfo(ClientID, &Info);
|
||||||
|
|
|
@ -440,7 +440,7 @@ void CGameTeams::SendTeamsState(int ClientID)
|
||||||
|
|
||||||
Server()->SendMsg(&Msg, MSGFLAG_VITAL, ClientID);
|
Server()->SendMsg(&Msg, MSGFLAG_VITAL, ClientID);
|
||||||
int ClientVersion = m_pGameContext->m_apPlayers[ClientID]->GetClientVersion();
|
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);
|
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;
|
CNetMsg_Sv_DDRaceTime Msg;
|
||||||
Msg.m_Time = (int)(Time * 100.0f);
|
CNetMsg_Sv_DDRaceTimeLegacy MsgLegacy;
|
||||||
Msg.m_Check = 0;
|
MsgLegacy.m_Time = Msg.m_Time = (int)(Time * 100.0f);
|
||||||
Msg.m_Finish = 1;
|
MsgLegacy.m_Check = Msg.m_Check = 0;
|
||||||
|
MsgLegacy.m_Finish = Msg.m_Finish = 1;
|
||||||
|
|
||||||
if(pData->m_BestTime)
|
if(pData->m_BestTime)
|
||||||
{
|
{
|
||||||
float Diff = (Time - pData->m_BestTime) * 100;
|
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);
|
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