mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Show others for ddrace clients.
Need to fix entities now. Signed-off-by: btd <bardadymchik@gmail.com>
This commit is contained in:
parent
dab31de735
commit
a62decbc91
|
@ -310,6 +310,7 @@ class NetIntAny(NetVariable):
|
|||
def emit_pack(self):
|
||||
return ["pPacker->AddInt(%s);" % self.name]
|
||||
|
||||
|
||||
class NetIntRange(NetIntAny):
|
||||
def __init__(self, name, min, max):
|
||||
NetIntAny.__init__(self,name)
|
||||
|
|
|
@ -296,7 +296,7 @@ Messages = [
|
|||
|
||||
NetMessage("Cl_IsRace", []),
|
||||
|
||||
NetMessage("Cl_Team", [
|
||||
NetMessage("Cl_TeamsState", [
|
||||
NetIntAny("m_Tee0"),
|
||||
NetIntAny("m_Tee1"),
|
||||
NetIntAny("m_Tee2"),
|
||||
|
|
|
@ -147,5 +147,5 @@ MACRO_CONFIG_STR(SvRulesLine10, sv_rules_line10, 40, "", CFGFLAG_SERVER, "Rules
|
|||
MACRO_CONFIG_INT(SvTeam, sv_team, 0, -1, 1, CFGFLAG_SERVER, "Teams configuration", 4)
|
||||
MACRO_CONFIG_INT(SvTeamStrict, sv_team_strict, 0, 0, 1, CFGFLAG_SERVER, "Kill or not all team if someone left game in team", 4)
|
||||
|
||||
MACRO_CONFIG_INT(SvConnTimeout, sv_conn_timeout, 10, 5, 100, CFGFLAG_CLIENT|CFGFLAG_SERVER, "Network timeout for init", 4)
|
||||
MACRO_CONFIG_INT(ConnTimeout, conn_timeout, 15, 5, 100, CFGFLAG_CLIENT|CFGFLAG_SERVER, "Network timeout", 4)
|
||||
#endif
|
||||
|
|
|
@ -301,7 +301,7 @@ int CNetConnection::Update()
|
|||
// check for timeout
|
||||
if(State() != NET_CONNSTATE_OFFLINE &&
|
||||
State() != NET_CONNSTATE_CONNECT &&
|
||||
(Now-m_LastRecvTime) > time_freq()*g_Config.m_SvConnTimeout)
|
||||
(Now-m_LastRecvTime) > time_freq()*g_Config.m_ConnTimeout)
|
||||
{
|
||||
m_State = NET_CONNSTATE_ERROR;
|
||||
SetError("Timeout");
|
||||
|
@ -313,11 +313,11 @@ int CNetConnection::Update()
|
|||
CNetChunkResend *pResend = m_Buffer.First();
|
||||
|
||||
// check if we have some really old stuff laying around and abort if not acked
|
||||
if(Now-pResend->m_FirstSendTime > time_freq()*g_Config.m_SvConnTimeout)
|
||||
if(Now-pResend->m_FirstSendTime > time_freq()*g_Config.m_ConnTimeout)
|
||||
{
|
||||
m_State = NET_CONNSTATE_ERROR;
|
||||
char aBuf[512];
|
||||
str_format(aBuf, sizeof(aBuf), "Too weak connection (not acked for %d seconds)", g_Config.m_SvConnTimeout);
|
||||
str_format(aBuf, sizeof(aBuf), "Too weak connection (not acked for %d seconds)", g_Config.m_ConnTimeout);
|
||||
SetError(aBuf);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -395,6 +395,8 @@ void CGameClient::OnReset()
|
|||
m_Teams.Reset();
|
||||
Layers()->Dest();
|
||||
Collision()->Dest();
|
||||
|
||||
m_RaceMsgSent = false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -579,6 +581,31 @@ void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker)
|
|||
else
|
||||
g_GameClient.m_pSounds->Play(CSounds::CHN_GLOBAL, pMsg->m_Soundid, 1.0f, vec2(0,0));
|
||||
}
|
||||
else if(MsgId == NETMSGTYPE_CL_TEAMSSTATE) {
|
||||
CNetMsg_Cl_TeamsState *pMsg = (CNetMsg_Cl_TeamsState *)pRawMsg;
|
||||
m_Teams.Team(0, pMsg->m_Tee0);
|
||||
m_Teams.Team(1, pMsg->m_Tee1);
|
||||
m_Teams.Team(2, pMsg->m_Tee2);
|
||||
m_Teams.Team(3, pMsg->m_Tee3);
|
||||
m_Teams.Team(4, pMsg->m_Tee4);
|
||||
m_Teams.Team(5, pMsg->m_Tee5);
|
||||
m_Teams.Team(6, pMsg->m_Tee6);
|
||||
m_Teams.Team(7, pMsg->m_Tee7);
|
||||
m_Teams.Team(8, pMsg->m_Tee8);
|
||||
m_Teams.Team(9, pMsg->m_Tee9);
|
||||
m_Teams.Team(10, pMsg->m_Tee10);
|
||||
m_Teams.Team(11, pMsg->m_Tee11);
|
||||
m_Teams.Team(12, pMsg->m_Tee12);
|
||||
m_Teams.Team(13, pMsg->m_Tee13);
|
||||
m_Teams.Team(14, pMsg->m_Tee14);
|
||||
m_Teams.Team(15, pMsg->m_Tee15);
|
||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||
{
|
||||
char aBuf[512];
|
||||
str_format(aBuf, sizeof(aBuf), "Team = %d", m_Teams.Team(i));
|
||||
dbg_msg("Teams", aBuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CGameClient::OnStateChange(int NewState, int OldState)
|
||||
|
@ -859,7 +886,7 @@ void CGameClient::OnPredict()
|
|||
|
||||
g_GameClient.m_aClients[i].m_Predicted.Init(&World, Collision(), &m_Teams);
|
||||
World.m_apCharacters[i] = &g_GameClient.m_aClients[i].m_Predicted;
|
||||
World.m_apCharacters[i]->m_Id = m_Snap.m_LocalCid;
|
||||
World.m_apCharacters[i]->m_Id = m_Snap.m_paPlayerInfos[i]->m_ClientId;
|
||||
g_GameClient.m_aClients[i].m_Predicted.Read(&m_Snap.m_aCharacters[i].m_Cur);
|
||||
}
|
||||
|
||||
|
|
|
@ -242,13 +242,13 @@ void CCharacterCore::Tick(bool UseInput)
|
|||
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||
{
|
||||
CCharacterCore *p = m_pWorld->m_apCharacters[i];
|
||||
|
||||
|
||||
char aBuf[512];
|
||||
str_format(aBuf, sizeof(aBuf), "ThisId = %d Id = %d Team = %d", m_Id, i, m_pTeams->Team(i));
|
||||
dbg_msg("GameCore", aBuf);
|
||||
if(!p || p == this || !m_pTeams->CanCollide(i, m_Id))
|
||||
continue;
|
||||
//char aBuf[512];
|
||||
//str_format(aBuf, sizeof(aBuf), "ThisId = %d Id = %d TheSameTeam? = %d", ThisId, i, m_pTeams->SameTeam(i, ThisId));
|
||||
//dbg_msg("GameCore", aBuf);
|
||||
|
||||
|
||||
vec2 ClosestPoint = closest_point_on_line(m_HookPos, NewPos, p->m_Pos);
|
||||
if(distance(p->m_Pos, ClosestPoint) < PhysSize+2.0f)
|
||||
{
|
||||
|
|
|
@ -1279,21 +1279,13 @@ void CCharacter::Snap(int SnappingClient)
|
|||
return;
|
||||
|
||||
CCharacter* SnapChar = GameServer()->GetPlayerChar(SnappingClient);
|
||||
if
|
||||
(
|
||||
SnapChar &&
|
||||
!SnapChar->m_Super &&
|
||||
(
|
||||
GameServer()->m_apPlayers[SnappingClient]->GetTeam() != -1 &&
|
||||
SnapChar->Team() != Team() &&
|
||||
Team() != TEAM_SUPER
|
||||
) ||
|
||||
(
|
||||
GetPlayer()->m_Invisible &&
|
||||
GetPlayer()->GetCID() != SnappingClient &&
|
||||
GameServer()->m_apPlayers[SnappingClient]->m_Authed < GetPlayer()->m_Authed
|
||||
)
|
||||
)
|
||||
if(SnapChar && !SnapChar->m_Super &&
|
||||
GameServer()->m_apPlayers[SnappingClient]->GetTeam() != -1 &&
|
||||
!CanCollide(SnappingClient) && !GameServer()->m_apPlayers[SnappingClient]->m_IsUsingRaceClient) return;
|
||||
if(GetPlayer()->m_Invisible &&
|
||||
GetPlayer()->GetCID() != SnappingClient &&
|
||||
GameServer()->m_apPlayers[SnappingClient]->m_Authed < GetPlayer()->m_Authed
|
||||
)
|
||||
return;
|
||||
CNetObj_Character *Character = static_cast<CNetObj_Character *>(Server()->SnapNewItem(NETOBJTYPE_CHARACTER, m_pPlayer->GetCID(), sizeof(CNetObj_Character)));
|
||||
|
||||
|
|
|
@ -604,7 +604,7 @@ void CGameContext::OnClientEnter(int ClientId)
|
|||
SendChatTarget(ClientId, "Note This is an Alpha release, just for testing, your feedback is important!!");
|
||||
|
||||
if(g_Config.m_SvWelcome[0]!=0) SendChatTarget(ClientId,g_Config.m_SvWelcome);
|
||||
str_format(aBuf, sizeof(aBuf), "team_join player='%d:%s' team=%d", ClientId, Server()->ClientName(ClientId), m_apPlayers[ClientId]->GetTeam());
|
||||
//str_format(aBuf, sizeof(aBuf), "team_join player='%d:%s' team=%d", ClientId, Server()->ClientName(ClientId), m_apPlayers[ClientId]->GetTeam());
|
||||
|
||||
Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "game", aBuf);
|
||||
|
||||
|
@ -961,7 +961,10 @@ void CGameContext::OnMessage(int MsgId, CUnpacker *pUnpacker, int ClientId)
|
|||
else if (MsgId == NETMSGTYPE_CL_ISRACE)
|
||||
{
|
||||
pPlayer->m_IsUsingRaceClient = true;
|
||||
|
||||
char aBuf[128];
|
||||
str_format(aBuf, sizeof(aBuf), "%d use DDRace Client", pPlayer->GetCID());
|
||||
dbg_msg("DDRace", aBuf);
|
||||
((CGameControllerDDRace*)m_pController)->m_Teams.SendTeamsState(ClientId);
|
||||
}
|
||||
else if(MsgId == NETMSGTYPE_CL_CHANGEINFO || MsgId == NETMSGTYPE_CL_STARTINFO)
|
||||
{
|
||||
|
|
|
@ -90,6 +90,9 @@ bool CGameTeams::SetCharacterTeam(int id, int Team) {
|
|||
char aBuf[512];
|
||||
str_format(aBuf, sizeof(aBuf), "Id = %d Team = %d", id, Team);
|
||||
dbg_msg("Teams", aBuf);
|
||||
if(Character(id) && Character(id)->GetPlayer()->m_IsUsingRaceClient) {
|
||||
SendTeamsState(id);
|
||||
}
|
||||
//GameServer()->CreatePlayerSpawn(Character(id)->m_Core.m_Pos, TeamMask());
|
||||
return true;
|
||||
}
|
||||
|
@ -141,3 +144,26 @@ int CGameTeams::TeamMask(int Team) {
|
|||
}
|
||||
return Mask;
|
||||
}
|
||||
|
||||
void CGameTeams::SendTeamsState(int Cid) {
|
||||
CNetMsg_Cl_TeamsState Msg;
|
||||
Msg.m_Tee0 = m_Core.Team(0);
|
||||
Msg.m_Tee1 = m_Core.Team(1);
|
||||
Msg.m_Tee2 = m_Core.Team(2);
|
||||
Msg.m_Tee3 = m_Core.Team(3);
|
||||
Msg.m_Tee4 = m_Core.Team(4);
|
||||
Msg.m_Tee5 = m_Core.Team(5);
|
||||
Msg.m_Tee6 = m_Core.Team(6);
|
||||
Msg.m_Tee7 = m_Core.Team(7);
|
||||
Msg.m_Tee8 = m_Core.Team(8);
|
||||
Msg.m_Tee9 = m_Core.Team(9);
|
||||
Msg.m_Tee10 = m_Core.Team(10);
|
||||
Msg.m_Tee11 = m_Core.Team(11);
|
||||
Msg.m_Tee12 = m_Core.Team(12);
|
||||
Msg.m_Tee13 = m_Core.Team(13);
|
||||
Msg.m_Tee14 = m_Core.Team(14);
|
||||
Msg.m_Tee15 = m_Core.Team(15);
|
||||
|
||||
Server()->SendPackMsg(&Msg, MSGFLAG_VITAL, Cid);
|
||||
|
||||
}
|
||||
|
|
|
@ -44,6 +44,8 @@ public:
|
|||
void SetForceCharacterTeam(int id, int Team);
|
||||
|
||||
void Reset();
|
||||
|
||||
void SendTeamsState(int Cid);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue