mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 22:48:18 +00:00
fixed ddrace score (time score)
This commit is contained in:
parent
0e842359ad
commit
fe4426b008
|
@ -204,7 +204,7 @@ public:
|
||||||
|
|
||||||
virtual void OnRconType(bool UsernameReq) = 0;
|
virtual void OnRconType(bool UsernameReq) = 0;
|
||||||
virtual void OnRconLine(const char *pLine) = 0;
|
virtual void OnRconLine(const char *pLine) = 0;
|
||||||
virtual void OnDDRaceScore(int AllowDDRaceScore, bool Dummy) = 0;
|
virtual void OnTimeScore(int AllowTimeScore, bool Dummy) = 0;
|
||||||
virtual void OnInit() = 0;
|
virtual void OnInit() = 0;
|
||||||
virtual void OnNewSnapshot() = 0;
|
virtual void OnNewSnapshot() = 0;
|
||||||
virtual void OnEnterGame() = 0;
|
virtual void OnEnterGame() = 0;
|
||||||
|
|
|
@ -721,7 +721,7 @@ void CClient::Connect(const char *pAddress, const char *pPassword)
|
||||||
|
|
||||||
GenerateTimeoutCodes();
|
GenerateTimeoutCodes();
|
||||||
|
|
||||||
GameClient()->OnDDRaceScore(1, false);
|
GameClient()->OnTimeScore(1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClient::DisconnectWithReason(const char *pReason)
|
void CClient::DisconnectWithReason(const char *pReason)
|
||||||
|
@ -808,7 +808,7 @@ void CClient::DummyConnect()
|
||||||
//connecting to the server
|
//connecting to the server
|
||||||
m_NetClient[1].Connect(&m_ServerAddress);
|
m_NetClient[1].Connect(&m_ServerAddress);
|
||||||
|
|
||||||
GameClient()->OnDDRaceScore(1, true);
|
GameClient()->OnTimeScore(1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CClient::DummyDisconnect(const char *pReason)
|
void CClient::DummyDisconnect(const char *pReason)
|
||||||
|
@ -1938,15 +1938,12 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket)
|
||||||
bool UsernameReq = Unpacker.GetInt() & 1;
|
bool UsernameReq = Unpacker.GetInt() & 1;
|
||||||
GameClient()->OnRconType(UsernameReq);
|
GameClient()->OnRconType(UsernameReq);
|
||||||
}
|
}
|
||||||
else if(Msg == NETMSG_DDRACE_SCORE)
|
else if(Msg == NETMSG_TIME_SCORE)
|
||||||
{
|
{
|
||||||
int NewDDRaceScore = Unpacker.GetInt();
|
int NewTimeScore = Unpacker.GetInt();
|
||||||
if (Unpacker.Error())
|
if (Unpacker.Error())
|
||||||
return;
|
return;
|
||||||
if (!g_Config.m_ClDummy)
|
GameClient()->OnTimeScore(NewTimeScore, g_Config.m_ClDummy)
|
||||||
GameClient()->OnDDRaceScore(NewDDRaceScore, false);
|
|
||||||
else
|
|
||||||
GameClient()->OnDDRaceScore(NewDDRaceScore, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2170,10 +2167,10 @@ void CClient::ProcessServerPacketDummy(CNetChunk *pPacket)
|
||||||
}
|
}
|
||||||
else if(Msg == NETMSG_DDRACE_SCORE)
|
else if(Msg == NETMSG_DDRACE_SCORE)
|
||||||
{
|
{
|
||||||
int NewDDRaceScore = Unpacker.GetInt();
|
int NewTimeScore = Unpacker.GetInt();
|
||||||
if (Unpacker.Error())
|
if (Unpacker.Error())
|
||||||
return;
|
return;
|
||||||
GameClient()->OnDDRaceScore(NewDDRaceScore, true);
|
GameClient()->OnTimeScore(NewTimeScore, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -1012,10 +1012,6 @@ void CServer::SendMapData(int ClientID, int Chunk)
|
||||||
|
|
||||||
void CServer::SendConnectionReady(int ClientID)
|
void CServer::SendConnectionReady(int ClientID)
|
||||||
{
|
{
|
||||||
CMsgPacker aMsg(NETMSG_DDRACE_SCORE);
|
|
||||||
aMsg.AddInt(g_Config.m_SvDDRaceScore);
|
|
||||||
SendMsgEx(&aMsg, MSGFLAG_VITAL | MSGFLAG_NORECORD, ClientID, true);
|
|
||||||
|
|
||||||
CMsgPacker Msg(NETMSG_CON_READY);
|
CMsgPacker Msg(NETMSG_CON_READY);
|
||||||
SendMsgEx(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH, ClientID, true);
|
SendMsgEx(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH, ClientID, true);
|
||||||
}
|
}
|
||||||
|
@ -2095,13 +2091,6 @@ void CServer::ConRescue(CConsole::IResult *pResult, void *pUser)
|
||||||
((CConsole*)pUser)->Print(CConsole::OUTPUT_LEVEL_STANDARD, "console", aBuf);
|
((CConsole*)pUser)->Print(CConsole::OUTPUT_LEVEL_STANDARD, "console", aBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CServer::ConDDRaceScore(CConsole::IResult *pResult, void *pUser)
|
|
||||||
{
|
|
||||||
char aBuf[128];
|
|
||||||
str_format(aBuf, sizeof(aBuf), "Value: %d", g_Config.m_SvDDRaceScore);
|
|
||||||
((CConsole*)pUser)->Print(CConsole::OUTPUT_LEVEL_STANDARD, "console", aBuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CServer::ConKick(IConsole::IResult *pResult, void *pUser)
|
void CServer::ConKick(IConsole::IResult *pResult, void *pUser)
|
||||||
{
|
{
|
||||||
if(pResult->NumArguments() > 1)
|
if(pResult->NumArguments() > 1)
|
||||||
|
@ -2974,7 +2963,6 @@ int main(int argc, const char **argv) // ignore_convention
|
||||||
|
|
||||||
pConsole->Register("sv_test_cmds", "", CFGFLAG_SERVER, CServer::ConTestingCommands, pConsole, "Turns testing commands aka cheats on/off");
|
pConsole->Register("sv_test_cmds", "", CFGFLAG_SERVER, CServer::ConTestingCommands, pConsole, "Turns testing commands aka cheats on/off");
|
||||||
pConsole->Register("sv_rescue", "", CFGFLAG_SERVER, CServer::ConRescue, pConsole, "Allow /rescue command so players can teleport themselves out of freeze");
|
pConsole->Register("sv_rescue", "", CFGFLAG_SERVER, CServer::ConRescue, pConsole, "Allow /rescue command so players can teleport themselves out of freeze");
|
||||||
pConsole->Register("sv_ddrace_score", "", CFGFLAG_SERVER, CServer::ConDDRaceScore, pConsole, "Allows the client to use DDRace scores");
|
|
||||||
|
|
||||||
pEngine->InitLogfile();
|
pEngine->InitLogfile();
|
||||||
|
|
||||||
|
|
|
@ -306,7 +306,6 @@ public:
|
||||||
|
|
||||||
static void ConTestingCommands(IConsole::IResult *pResult, void *pUser);
|
static void ConTestingCommands(IConsole::IResult *pResult, void *pUser);
|
||||||
static void ConRescue(IConsole::IResult *pResult, void *pUser);
|
static void ConRescue(IConsole::IResult *pResult, void *pUser);
|
||||||
static void ConDDRaceScore(IConsole::IResult *pResult, void *pUser);
|
|
||||||
static void ConKick(IConsole::IResult *pResult, void *pUser);
|
static void ConKick(IConsole::IResult *pResult, void *pUser);
|
||||||
static void ConStatus(IConsole::IResult *pResult, void *pUser);
|
static void ConStatus(IConsole::IResult *pResult, void *pUser);
|
||||||
static void ConShutdown(IConsole::IResult *pResult, void *pUser);
|
static void ConShutdown(IConsole::IResult *pResult, void *pUser);
|
||||||
|
|
|
@ -156,7 +156,6 @@ MACRO_CONFIG_STR(SvDnsblKey, sv_dnsbl_key, 128, "", CFGFLAG_SERVER|CFGFLAG_NONTE
|
||||||
MACRO_CONFIG_INT(SvDnsblVote, sv_dnsbl_vote, 0, 0, 1, CFGFLAG_SERVER, "Block votes by blacklisted addresses")
|
MACRO_CONFIG_INT(SvDnsblVote, sv_dnsbl_vote, 0, 0, 1, CFGFLAG_SERVER, "Block votes by blacklisted addresses")
|
||||||
MACRO_CONFIG_INT(SvDnsblBan, sv_dnsbl_ban, 0, 0, 1, CFGFLAG_SERVER, "Automatically ban blacklisted addresses")
|
MACRO_CONFIG_INT(SvDnsblBan, sv_dnsbl_ban, 0, 0, 1, CFGFLAG_SERVER, "Automatically ban blacklisted addresses")
|
||||||
MACRO_CONFIG_INT(SvRconVote, sv_rcon_vote, 0, 0, 1, CFGFLAG_SERVER, "Only allow authed clients to call votes")
|
MACRO_CONFIG_INT(SvRconVote, sv_rcon_vote, 0, 0, 1, CFGFLAG_SERVER, "Only allow authed clients to call votes")
|
||||||
MACRO_CONFIG_INT(SvDDRaceScore, sv_ddrace_score, 1, 0, 1, CFGFLAG_SERVER, "Allows the client to use DDRace scores")
|
|
||||||
|
|
||||||
MACRO_CONFIG_INT(SvPlayerDemoRecord, sv_player_demo_record, 0, 0, 1, CFGFLAG_SERVER, "Automatically record demos for each player")
|
MACRO_CONFIG_INT(SvPlayerDemoRecord, sv_player_demo_record, 0, 0, 1, CFGFLAG_SERVER, "Automatically record demos for each player")
|
||||||
MACRO_CONFIG_INT(SvDemoChat, sv_demo_chat, 0, 0, 1, CFGFLAG_SERVER, "Record chat for demos")
|
MACRO_CONFIG_INT(SvDemoChat, sv_demo_chat, 0, 0, 1, CFGFLAG_SERVER, "Record chat for demos")
|
||||||
|
|
|
@ -25,4 +25,4 @@ UUID(NETMSG_IDONTKNOW, "i-dont-know@ddnet.tw")
|
||||||
|
|
||||||
UUID(NETMSG_RCONTYPE, "rcon-type@ddnet.tw")
|
UUID(NETMSG_RCONTYPE, "rcon-type@ddnet.tw")
|
||||||
UUID(NETMSG_MAP_DETAILS, "map-details@ddnet.tw")
|
UUID(NETMSG_MAP_DETAILS, "map-details@ddnet.tw")
|
||||||
UUID(NETMSG_DDRACE_SCORE, "ddrace-score@ddnet.tw")
|
UUID(NETMSG_TIME_SCORE, "time-score@ddnet.tw")
|
||||||
|
|
|
@ -340,7 +340,7 @@ void CHud::RenderScoreHud()
|
||||||
{
|
{
|
||||||
CServerInfo Info;
|
CServerInfo Info;
|
||||||
Client()->GetServerInfo(&Info);
|
Client()->GetServerInfo(&Info);
|
||||||
if(IsRace(&Info) && g_Config.m_ClDDRaceScoreBoard && ((m_pClient->m_AllowDDRaceScore[0] && !g_Config.m_ClDummy) || (m_pClient->m_AllowDDRaceScore[1] && g_Config.m_ClDummy)))
|
if(IsRace(&Info) && g_Config.m_ClDDRaceScoreBoard && m_pClient->m_AllowTimeScore[g_Config.m_ClDummy])
|
||||||
{
|
{
|
||||||
if(apPlayerInfo[t]->m_Score != -9999)
|
if(apPlayerInfo[t]->m_Score != -9999)
|
||||||
str_format(aScore[t], sizeof(aScore[t]), "%02d:%02d", abs(apPlayerInfo[t]->m_Score)/60, abs(apPlayerInfo[t]->m_Score)%60);
|
str_format(aScore[t], sizeof(aScore[t]), "%02d:%02d", abs(apPlayerInfo[t]->m_Score)/60, abs(apPlayerInfo[t]->m_Score)%60);
|
||||||
|
|
|
@ -222,7 +222,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_IsGameTypeRace && g_Config.m_ClDDRaceScoreBoard && ((m_pClient->m_AllowDDRaceScore[0] && !g_Config.m_ClDummy) || (m_pClient->m_AllowDDRaceScore[1] && g_Config.m_ClDummy)))
|
if(m_IsGameTypeRace && g_Config.m_ClDDRaceScoreBoard && m_pClient->m_AllowTimeScore[g_Config.m_ClDummy])
|
||||||
{
|
{
|
||||||
if (m_ServerRecord > 0)
|
if (m_ServerRecord > 0)
|
||||||
{
|
{
|
||||||
|
@ -404,7 +404,7 @@ void CScoreboard::RenderScoreboard(float x, float y, float w, int Team, const ch
|
||||||
}
|
}
|
||||||
|
|
||||||
// score
|
// score
|
||||||
if(m_IsGameTypeRace && g_Config.m_ClDDRaceScoreBoard && ((m_pClient->m_AllowDDRaceScore[0] && !g_Config.m_ClDummy) || (m_pClient->m_AllowDDRaceScore[1] && g_Config.m_ClDummy)))
|
if(m_IsGameTypeRace && g_Config.m_ClDDRaceScoreBoard && m_pClient->m_AllowTimeScore[g_Config.m_ClDummy])
|
||||||
{
|
{
|
||||||
if (pInfo->m_Score == -9999)
|
if (pInfo->m_Score == -9999)
|
||||||
aBuf[0] = 0;
|
aBuf[0] = 0;
|
||||||
|
|
|
@ -937,12 +937,9 @@ void CGameClient::OnRconLine(const char *pLine)
|
||||||
m_pGameConsole->PrintLine(CGameConsole::CONSOLETYPE_REMOTE, pLine);
|
m_pGameConsole->PrintLine(CGameConsole::CONSOLETYPE_REMOTE, pLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameClient::OnDDRaceScore(int AllowDDRaceScore, bool Dummy)
|
void CGameClient::OnTimeScore(int AllowTimeScore, bool Dummy)
|
||||||
{
|
{
|
||||||
if(!Dummy)
|
m_AllowTimeScore[Dummy] = AllowTimeScore;
|
||||||
m_AllowDDRaceScore[0] = AllowDDRaceScore;
|
|
||||||
else
|
|
||||||
m_AllowDDRaceScore[1] = AllowDDRaceScore;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameClient::ProcessEvents()
|
void CGameClient::ProcessEvents()
|
||||||
|
|
|
@ -164,7 +164,7 @@ public:
|
||||||
};
|
};
|
||||||
int m_ServerMode;
|
int m_ServerMode;
|
||||||
|
|
||||||
int m_AllowDDRaceScore[2];
|
int m_AllowTimeScore[2];
|
||||||
|
|
||||||
int m_DemoSpecID;
|
int m_DemoSpecID;
|
||||||
|
|
||||||
|
@ -316,7 +316,7 @@ public:
|
||||||
virtual void OnEnterGame();
|
virtual void OnEnterGame();
|
||||||
virtual void OnRconType(bool UsernameReq);
|
virtual void OnRconType(bool UsernameReq);
|
||||||
virtual void OnRconLine(const char *pLine);
|
virtual void OnRconLine(const char *pLine);
|
||||||
virtual void OnDDRaceScore(int AllowDDRaceScore, bool Dummy);
|
virtual void OnTimeScore(int AllowTimeScore, bool Dummy);
|
||||||
virtual void OnGameOver();
|
virtual void OnGameOver();
|
||||||
virtual void OnStartGame();
|
virtual void OnStartGame();
|
||||||
virtual void OnFlagGrab(int TeamID);
|
virtual void OnFlagGrab(int TeamID);
|
||||||
|
|
Loading…
Reference in a new issue