Skip to content

Commit

Permalink
Merge branch 'ddnet' into chillerbot
Browse files Browse the repository at this point in the history
  • Loading branch information
ChillerDragon committed Sep 14, 2024
2 parents b27b6cd + 868c513 commit 85afe87
Show file tree
Hide file tree
Showing 13 changed files with 351 additions and 337 deletions.
2 changes: 1 addition & 1 deletion scripts/check_config_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def parse_config_variables(lines):
return matches

def generate_regex(variable_code):
return fr'(g_Config\.m_{variable_code}|Config\(\)->m_{variable_code}|m_pConfig->m_{variable_code})'
return fr'(g_Config\.m_{variable_code}\b|Config\(\)->m_{variable_code}\b|m_pConfig->m_{variable_code}\b)'

def find_config_variables(config_variables):
"""Returns the config variables which were not found."""
Expand Down
32 changes: 30 additions & 2 deletions src/engine/client/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,8 @@ void CClient::DummyDisconnect(const char *pReason)
m_aReceivedSnapshots[1] = 0;
m_DummyConnected = false;
m_DummyConnecting = false;
m_DummyReconnectOnReload = false;
m_DummyDeactivateOnReconnect = false;
GameClient()->OnDummyDisconnect();
}

Expand Down Expand Up @@ -1564,7 +1566,7 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket, int Conn, bool Dummy)
}
}

if(m_DummyConnected)
if(m_DummyConnected && !m_DummyReconnectOnReload)
{
DummyDisconnect(0);
}
Expand Down Expand Up @@ -1693,17 +1695,33 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket, int Conn, bool Dummy)
}
}
}
else if(Conn == CONN_MAIN && (pPacket->m_Flags & NET_CHUNKFLAG_VITAL) != 0 && Msg == NETMSG_MAP_RELOAD)
{
if(m_DummyConnected)
{
m_DummyReconnectOnReload = true;
m_DummyDeactivateOnReconnect = g_Config.m_ClDummy == 0;
g_Config.m_ClDummy = 0;
}
else
m_DummyDeactivateOnReconnect = false;
}
else if(Conn == CONN_MAIN && (pPacket->m_Flags & NET_CHUNKFLAG_VITAL) != 0 && Msg == NETMSG_CON_READY)
{
GameClient()->OnConnected();
if(m_DummyReconnectOnReload)
{
m_DummySendConnInfo = true;
m_DummyReconnectOnReload = false;
}
}
else if(Conn == CONN_DUMMY && Msg == NETMSG_CON_READY)
{
m_DummyConnected = true;
m_DummyConnecting = false;
g_Config.m_ClDummy = 1;
Rcon("crashmeplx");
if(m_aRconAuthed[0])
if(m_aRconAuthed[0] && !m_aRconAuthed[1])
RconAuth(m_aRconUsername, m_aRconPassword);
}
else if(Msg == NETMSG_PING)
Expand Down Expand Up @@ -2790,6 +2808,16 @@ void CClient::Update()
}
}

if(m_DummyDeactivateOnReconnect && g_Config.m_ClDummy == 1)
{
m_DummyDeactivateOnReconnect = false;
g_Config.m_ClDummy = 0;
}
else if(!m_DummyConnected && m_DummyDeactivateOnReconnect)
{
m_DummyDeactivateOnReconnect = false;
}

m_LastDummy = (bool)g_Config.m_ClDummy;
}

Expand Down
2 changes: 2 additions & 0 deletions src/engine/client/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ class CClient : public IClient, public CDemoPlayer::IListener
bool m_DummyConnecting = false;
bool m_DummyConnected = false;
float m_LastDummyConnectTime = 0.0f;
bool m_DummyReconnectOnReload = false;
bool m_DummyDeactivateOnReconnect = false;

// graphs
CGraph m_InputtimeMarginGraph;
Expand Down
18 changes: 15 additions & 3 deletions src/engine/server/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ CServer::CServer()
}

m_MapReload = false;
m_SameMapReload = false;
m_ReloadedWhenEmpty = false;
m_aCurrentMap[0] = '\0';

Expand Down Expand Up @@ -1269,6 +1270,12 @@ void CServer::SendMapData(int ClientId, int Chunk)
}
}

void CServer::SendMapReload(int ClientId)
{
CMsgPacker Msg(NETMSG_MAP_RELOAD, true);
SendMsg(&Msg, MSGFLAG_VITAL | MSGFLAG_FLUSH, ClientId);
}

void CServer::SendConnectionReady(int ClientId)
{
CMsgPacker Msg(NETMSG_CON_READY, true);
Expand Down Expand Up @@ -2553,12 +2560,13 @@ void CServer::ChangeMap(const char *pMap)

void CServer::ReloadMap()
{
m_MapReload = true;
m_SameMapReload = true;
}

int CServer::LoadMap(const char *pMapName)
{
m_MapReload = false;
m_SameMapReload = false;

char aBuf[IO_MAX_PATH_LENGTH];
str_format(aBuf, sizeof(aBuf), "maps/%s.map", pMapName);
Expand Down Expand Up @@ -2805,8 +2813,9 @@ int CServer::Run()
int NewTicks = 0;

// load new map
if(m_MapReload || m_CurrentGameTick >= MAX_TICK) // force reload to make sure the ticks stay within a valid range
if(m_MapReload || m_SameMapReload || m_CurrentGameTick >= MAX_TICK) // force reload to make sure the ticks stay within a valid range
{
const bool SameMapReload = m_SameMapReload;
// load map
if(LoadMap(Config()->m_SvMap))
{
Expand All @@ -2831,6 +2840,9 @@ int CServer::Run()
if(m_aClients[ClientId].m_State <= CClient::STATE_AUTH)
continue;

if(SameMapReload)
SendMapReload(ClientId);

SendMap(ClientId);
bool HasPersistentData = m_aClients[ClientId].m_HasPersistentData;
m_aClients[ClientId].Reset();
Expand Down Expand Up @@ -3509,7 +3521,7 @@ void CServer::ConStopRecord(IConsole::IResult *pResult, void *pUser)

void CServer::ConMapReload(IConsole::IResult *pResult, void *pUser)
{
((CServer *)pUser)->m_MapReload = true;
((CServer *)pUser)->ReloadMap();
}

void CServer::ConLogout(IConsole::IResult *pResult, void *pUser)
Expand Down
2 changes: 2 additions & 0 deletions src/engine/server/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ class CServer : public IServer
int m_RunServer;

bool m_MapReload;
bool m_SameMapReload;
bool m_ReloadedWhenEmpty;
int m_RconClientId;
int m_RconAuthLevel;
Expand Down Expand Up @@ -324,6 +325,7 @@ class CServer : public IServer
void SendCapabilities(int ClientId);
void SendMap(int ClientId);
void SendMapData(int ClientId, int Chunk);
void SendMapReload(int ClientId);
void SendConnectionReady(int ClientId);
void SendRconLine(int ClientId, const char *pLine);
// Accepts -1 as ClientId to mean "all clients with at least auth level admin"
Expand Down
1 change: 1 addition & 0 deletions src/engine/shared/config_variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ MACRO_CONFIG_INT(ClShowfps, cl_showfps, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE,
MACRO_CONFIG_INT(ClShowpred, cl_showpred, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show ingame prediction time in milliseconds")
MACRO_CONFIG_INT(ClEyeWheel, cl_eye_wheel, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show eye wheel along together with emotes")
MACRO_CONFIG_INT(ClEyeDuration, cl_eye_duration, 999999, 1, 999999, CFGFLAG_CLIENT | CFGFLAG_SAVE, "How long the eyes emotes last")
MACRO_CONFIG_INT(ClFreezeStars, cl_freeze_stars, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show old star particles for frozen tees")

MACRO_CONFIG_INT(ClAirjumpindicator, cl_airjumpindicator, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show the air jump indicator")
MACRO_CONFIG_INT(ClThreadsoundloading, cl_threadsoundloading, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Load sound files threaded")
Expand Down
1 change: 1 addition & 0 deletions src/engine/shared/protocol_ex_msgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ UUID(NETMSG_CHECKSUM_ERROR, "checksum-error@ddnet.tw")
UUID(NETMSG_REDIRECT, "redirect@ddnet.org")
UUID(NETMSG_RCON_CMD_GROUP_START, "rcon-cmd-group-start@ddnet.org")
UUID(NETMSG_RCON_CMD_GROUP_END, "rcon-cmd-group-end@ddnet.org")
UUID(NETMSG_MAP_RELOAD, "map-reload@ddnet.org")
2 changes: 1 addition & 1 deletion src/game/client/components/menus.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ class CMenus : public CComponent
int m_SettingPlayerPage;

// 0.7 skins
bool m_CustomSkinMenu = false;
int m_TeePartSelected = protocol7::SKINPART_BODY;
const CSkins7::CSkin *m_pSelectedSkin = nullptr;
CLineInputBuffered<protocol7::MAX_SKIN_ARRAY_SIZE, protocol7::MAX_SKIN_LENGTH> m_SkinNameInput;
Expand Down Expand Up @@ -596,7 +597,6 @@ class CMenus : public CComponent
void RenderSettingsTee(CUIRect MainView);
void RenderSettingsTee7(CUIRect MainView);
void RenderSettingsTeeCustom7(CUIRect MainView);
void RenderSettingsTeeBasic7(CUIRect MainView);
void RenderSkinSelection7(CUIRect MainView);
void RenderSkinPartSelection7(CUIRect MainView);
void RenderSettingsControls(CUIRect MainView);
Expand Down
Loading

0 comments on commit 85afe87

Please sign in to comment.