mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-19 01:02:20 +00:00
Compare commits
6 commits
89b6a010c8
...
65524bc1c8
Author | SHA1 | Date | |
---|---|---|---|
65524bc1c8 | |||
11fd82077a | |||
28c7b01b96 | |||
3d30ce4bf2 | |||
9e0ba8a91f | |||
c89509bc4b |
|
@ -163,7 +163,7 @@ public:
|
|||
|
||||
// dummy
|
||||
virtual void DummyDisconnect(const char *pReason) = 0;
|
||||
virtual void DummyConnect() = 0;
|
||||
virtual void DummyConnect(bool Force = false) = 0;
|
||||
virtual bool DummyConnected() const = 0;
|
||||
virtual bool DummyConnecting() const = 0;
|
||||
virtual bool DummyConnectingDelayed() const = 0;
|
||||
|
|
|
@ -707,7 +707,7 @@ bool CClient::DummyConnectingDelayed() const
|
|||
return !DummyConnected() && !DummyConnecting() && m_LastDummyConnectTime > 0.0f && m_LastDummyConnectTime + 5.0f > GlobalTime();
|
||||
}
|
||||
|
||||
void CClient::DummyConnect()
|
||||
void CClient::DummyConnect(bool Force)
|
||||
{
|
||||
if(m_aNetClient[CONN_MAIN].State() != NETSTATE_ONLINE)
|
||||
{
|
||||
|
@ -725,7 +725,7 @@ void CClient::DummyConnect()
|
|||
log_info("client", "Dummy is already connected/connecting.");
|
||||
return;
|
||||
}
|
||||
if(DummyConnectingDelayed())
|
||||
if(!Force && DummyConnectingDelayed())
|
||||
{
|
||||
log_info("client", "Wait before connecting dummy again.");
|
||||
return;
|
||||
|
@ -1649,9 +1649,24 @@ 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_DummyReconnectOnLoad = true;
|
||||
m_DummySwapOnReconnect = g_Config.m_ClDummy == 1 ? false : true;
|
||||
}
|
||||
else
|
||||
m_DummySwapOnReconnect = false;
|
||||
}
|
||||
else if(Conn == CONN_MAIN && (pPacket->m_Flags & NET_CHUNKFLAG_VITAL) != 0 && Msg == NETMSG_CON_READY)
|
||||
{
|
||||
GameClient()->OnConnected();
|
||||
if(m_DummyReconnectOnLoad)
|
||||
{
|
||||
m_DummyReconnectOnLoad = false;
|
||||
DummyConnect(true);
|
||||
}
|
||||
}
|
||||
else if(Conn == CONN_DUMMY && Msg == NETMSG_CON_READY)
|
||||
{
|
||||
|
@ -2746,6 +2761,16 @@ void CClient::Update()
|
|||
}
|
||||
}
|
||||
|
||||
if(m_DummySwapOnReconnect && g_Config.m_ClDummy == 1)
|
||||
{
|
||||
m_DummySwapOnReconnect = false;
|
||||
g_Config.m_ClDummy = 0;
|
||||
}
|
||||
else if(!m_DummyConnected && m_DummySwapOnReconnect)
|
||||
{
|
||||
m_DummySwapOnReconnect = false;
|
||||
}
|
||||
|
||||
m_LastDummy = (bool)g_Config.m_ClDummy;
|
||||
}
|
||||
|
||||
|
|
|
@ -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_DummyReconnectOnLoad = false;
|
||||
bool m_DummySwapOnReconnect = false;
|
||||
|
||||
// graphs
|
||||
CGraph m_InputtimeMarginGraph;
|
||||
|
@ -319,7 +321,7 @@ public:
|
|||
void Disconnect() override;
|
||||
|
||||
void DummyDisconnect(const char *pReason) override;
|
||||
void DummyConnect() override;
|
||||
void DummyConnect(bool Force = false) override;
|
||||
bool DummyConnected() const override;
|
||||
bool DummyConnecting() const override;
|
||||
bool DummyConnectingDelayed() const override;
|
||||
|
|
|
@ -283,6 +283,7 @@ void CVideo::Pause(bool Pause)
|
|||
void CVideo::Stop()
|
||||
{
|
||||
dbg_assert(!m_Stopped, "Already stopped");
|
||||
m_Stopped = true;
|
||||
|
||||
m_pGraphics->WaitForIdle();
|
||||
|
||||
|
@ -341,8 +342,6 @@ void CVideo::Stop()
|
|||
pSound->PauseAudioDevice();
|
||||
delete ms_pCurrentVideo;
|
||||
pSound->UnpauseAudioDevice();
|
||||
|
||||
m_Stopped = true;
|
||||
}
|
||||
|
||||
void CVideo::NextVideoFrameThread()
|
||||
|
|
|
@ -3510,6 +3510,8 @@ void CServer::ConStopRecord(IConsole::IResult *pResult, void *pUser)
|
|||
void CServer::ConMapReload(IConsole::IResult *pResult, void *pUser)
|
||||
{
|
||||
((CServer *)pUser)->m_MapReload = true;
|
||||
CMsgPacker Msg(NETMSG_MAP_RELOAD, true);
|
||||
((CServer *)pUser)->SendMsg(&Msg, MSGFLAG_VITAL | MSGFLAG_FLUSH, -1);
|
||||
}
|
||||
|
||||
void CServer::ConLogout(IConsole::IResult *pResult, void *pUser)
|
||||
|
|
|
@ -35,3 +35,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")
|
||||
|
|
|
@ -93,6 +93,7 @@ MAYBE_UNUSED static const char *FONT_ICON_EARTH_AMERICAS = "\xEF\x95\xBD";
|
|||
MAYBE_UNUSED static const char *FONT_ICON_NETWORK_WIRED = "\xEF\x9B\xBF";
|
||||
MAYBE_UNUSED static const char *FONT_ICON_LIST_UL = "\xEF\x83\x8A";
|
||||
MAYBE_UNUSED static const char *FONT_ICON_INFO = "\xEF\x84\xA9";
|
||||
MAYBE_UNUSED static const char *FONT_ICON_TERMINAL = "\xEF\x84\xA0";
|
||||
|
||||
MAYBE_UNUSED static const char *FONT_ICON_SLASH = "\xEF\x9C\x95";
|
||||
MAYBE_UNUSED static const char *FONT_ICON_PLAY = "\xEF\x81\x8B";
|
||||
|
|
|
@ -160,8 +160,6 @@ class CGameConsole : public CComponent
|
|||
static const ColorRGBA ms_SearchHighlightColor;
|
||||
static const ColorRGBA ms_SearchSelectedColor;
|
||||
|
||||
void Toggle(int Type);
|
||||
|
||||
static void PossibleCommandsRenderCallback(int Index, const char *pStr, void *pUser);
|
||||
static void ConToggleLocalConsole(IConsole::IResult *pResult, void *pUserData);
|
||||
static void ConToggleRemoteConsole(IConsole::IResult *pResult, void *pUserData);
|
||||
|
@ -196,6 +194,7 @@ public:
|
|||
virtual bool OnInput(const IInput::CEvent &Event) override;
|
||||
void Prompt(char (&aPrompt)[32]);
|
||||
|
||||
void Toggle(int Type);
|
||||
bool IsClosed() { return m_ConsoleState == CONSOLE_CLOSED; }
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
#include "menus.h"
|
||||
|
||||
using namespace FontIcons;
|
||||
|
||||
void CMenus::RenderStartMenu(CUIRect MainView)
|
||||
{
|
||||
GameClient()->m_MenuBackground.ChangePosition(CMenuBackground::POS_START);
|
||||
|
@ -186,13 +188,27 @@ void CMenus::RenderStartMenu(CUIRect MainView)
|
|||
}
|
||||
|
||||
// render version
|
||||
CUIRect VersionUpdate, CurVersion;
|
||||
MainView.HSplitBottom(20.0f, nullptr, &VersionUpdate);
|
||||
VersionUpdate.VSplitRight(50.0f, &CurVersion, nullptr);
|
||||
VersionUpdate.VMargin(VMargin, &VersionUpdate);
|
||||
|
||||
CUIRect CurVersion, ConsoleButton;
|
||||
MainView.HSplitBottom(45.0f, nullptr, &CurVersion);
|
||||
CurVersion.VSplitRight(40.0f, &CurVersion, nullptr);
|
||||
CurVersion.HSplitTop(20.0f, &ConsoleButton, &CurVersion);
|
||||
CurVersion.HSplitTop(5.0f, nullptr, &CurVersion);
|
||||
ConsoleButton.VSplitRight(40.0f, nullptr, &ConsoleButton);
|
||||
Ui()->DoLabel(&CurVersion, GAME_RELEASE_VERSION, 14.0f, TEXTALIGN_MR);
|
||||
|
||||
static CButtonContainer s_ConsoleButton;
|
||||
TextRender()->SetFontPreset(EFontPreset::ICON_FONT);
|
||||
TextRender()->SetRenderFlags(ETextRenderFlags::TEXT_RENDER_FLAG_ONLY_ADVANCE_WIDTH | ETextRenderFlags::TEXT_RENDER_FLAG_NO_X_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_Y_BEARING | ETextRenderFlags::TEXT_RENDER_FLAG_NO_PIXEL_ALIGMENT | ETextRenderFlags::TEXT_RENDER_FLAG_NO_OVERSIZE);
|
||||
if(DoButton_Menu(&s_ConsoleButton, FONT_ICON_TERMINAL, 0, &ConsoleButton, nullptr, IGraphics::CORNER_ALL, 5.0f, 0.0f, ColorRGBA(0.0f, 0.0f, 0.0f, 0.1f)))
|
||||
{
|
||||
GameClient()->m_GameConsole.Toggle(CGameConsole::CONSOLETYPE_LOCAL);
|
||||
}
|
||||
TextRender()->SetRenderFlags(0);
|
||||
TextRender()->SetFontPreset(EFontPreset::DEFAULT_FONT);
|
||||
|
||||
CUIRect VersionUpdate;
|
||||
MainView.HSplitBottom(20.0f, nullptr, &VersionUpdate);
|
||||
VersionUpdate.VMargin(VMargin, &VersionUpdate);
|
||||
#if defined(CONF_AUTOUPDATE)
|
||||
CUIRect UpdateButton;
|
||||
VersionUpdate.VSplitRight(100.0f, &VersionUpdate, &UpdateButton);
|
||||
|
|
|
@ -3237,6 +3237,8 @@ void CGameContext::ConHotReload(IConsole::IResult *pResult, void *pUserData)
|
|||
pSelf->m_apSavedTeams[pSelf->m_aTeamMapping[i]]->Save(pSelf, pSelf->m_aTeamMapping[i], true, true);
|
||||
}
|
||||
pSelf->Server()->ReloadMap();
|
||||
CMsgPacker Msg(NETMSG_MAP_RELOAD, true);
|
||||
pSelf->Server()->SendMsg(&Msg, MSGFLAG_VITAL | MSGFLAG_FLUSH, -1);
|
||||
}
|
||||
|
||||
void CGameContext::ConAddVote(IConsole::IResult *pResult, void *pUserData)
|
||||
|
|
Loading…
Reference in a new issue