mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Merge branch 'master' of http://github.com/oy/teeworlds
Conflicts: src/engine/shared/config_variables.h src/game/client/components/console.cpp src/game/client/gameclient.cpp src/game/editor/ed_editor.h src/game/server/gamecontext.cpp
This commit is contained in:
commit
a109e1150d
BIN
data/file_icons.png
Normal file
BIN
data/file_icons.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
|
@ -227,6 +227,7 @@ image_browseicons = Image("browseicons", "browse_icons.png")
|
||||||
image_emoticons = Image("emoticons", "emoticons.png")
|
image_emoticons = Image("emoticons", "emoticons.png")
|
||||||
image_speedup_arrow = Image("speedup_arrow", "editor/speed_arrow.png")
|
image_speedup_arrow = Image("speedup_arrow", "editor/speed_arrow.png")
|
||||||
image_demobuttons = Image("demobuttons", "demo_buttons.png")
|
image_demobuttons = Image("demobuttons", "demo_buttons.png")
|
||||||
|
image_fileicons = Image("fileicons", "file_icons.png")
|
||||||
|
|
||||||
container.images.Add(image_null)
|
container.images.Add(image_null)
|
||||||
container.images.Add(image_game)
|
container.images.Add(image_game)
|
||||||
|
@ -239,6 +240,7 @@ container.images.Add(Image("console_bg", "console.png"))
|
||||||
container.images.Add(Image("console_bar", "console_bar.png"))
|
container.images.Add(Image("console_bar", "console_bar.png"))
|
||||||
container.images.Add(image_speedup_arrow)
|
container.images.Add(image_speedup_arrow)
|
||||||
container.images.Add(image_demobuttons)
|
container.images.Add(image_demobuttons)
|
||||||
|
container.images.Add(image_fileicons)
|
||||||
|
|
||||||
container.pickups.Add(Pickup("health"))
|
container.pickups.Add(Pickup("health"))
|
||||||
container.pickups.Add(Pickup("armor"))
|
container.pickups.Add(Pickup("armor"))
|
||||||
|
@ -252,6 +254,7 @@ set_browseicons = SpriteSet("browseicons", image_browseicons, 4, 1)
|
||||||
set_emoticons = SpriteSet("emoticons", image_emoticons, 4, 4)
|
set_emoticons = SpriteSet("emoticons", image_emoticons, 4, 4)
|
||||||
set_speedup_arrow = SpriteSet("speedup_arrow", image_speedup_arrow, 1, 1)
|
set_speedup_arrow = SpriteSet("speedup_arrow", image_speedup_arrow, 1, 1)
|
||||||
set_demobuttons = SpriteSet("demobuttons", image_demobuttons, 5, 1)
|
set_demobuttons = SpriteSet("demobuttons", image_demobuttons, 5, 1)
|
||||||
|
set_fileicons = SpriteSet("fileicons", image_fileicons, 8, 1)
|
||||||
|
|
||||||
container.spritesets.Add(set_particles)
|
container.spritesets.Add(set_particles)
|
||||||
container.spritesets.Add(set_game)
|
container.spritesets.Add(set_game)
|
||||||
|
@ -260,6 +263,7 @@ container.spritesets.Add(set_browseicons)
|
||||||
container.spritesets.Add(set_emoticons)
|
container.spritesets.Add(set_emoticons)
|
||||||
container.spritesets.Add(set_speedup_arrow)
|
container.spritesets.Add(set_speedup_arrow)
|
||||||
container.spritesets.Add(set_demobuttons)
|
container.spritesets.Add(set_demobuttons)
|
||||||
|
container.spritesets.Add(set_fileicons)
|
||||||
|
|
||||||
container.sprites.Add(Sprite("part_slice", set_particles, 0,0,1,1))
|
container.sprites.Add(Sprite("part_slice", set_particles, 0,0,1,1))
|
||||||
container.sprites.Add(Sprite("part_ball", set_particles, 1,0,1,1))
|
container.sprites.Add(Sprite("part_ball", set_particles, 1,0,1,1))
|
||||||
|
@ -378,6 +382,12 @@ container.sprites.Add(Sprite("demobutton_stop", set_demobuttons, 2,0,1,1))
|
||||||
container.sprites.Add(Sprite("demobutton_slower", set_demobuttons, 3,0,1,1))
|
container.sprites.Add(Sprite("demobutton_slower", set_demobuttons, 3,0,1,1))
|
||||||
container.sprites.Add(Sprite("demobutton_faster", set_demobuttons, 4,0,1,1))
|
container.sprites.Add(Sprite("demobutton_faster", set_demobuttons, 4,0,1,1))
|
||||||
|
|
||||||
|
container.sprites.Add(Sprite("file_demo1", set_fileicons, 0,0,1,1))
|
||||||
|
container.sprites.Add(Sprite("file_demo2", set_fileicons, 1,0,1,1))
|
||||||
|
container.sprites.Add(Sprite("file_folder", set_fileicons, 2,0,1,1))
|
||||||
|
container.sprites.Add(Sprite("file_map1", set_fileicons, 5,0,1,1))
|
||||||
|
container.sprites.Add(Sprite("file_map2", set_fileicons, 6,0,1,1))
|
||||||
|
|
||||||
|
|
||||||
anim = Animation("base")
|
anim = Animation("base")
|
||||||
anim.body.frames.Add(AnimKeyframe(0, 0, -4, 0))
|
anim.body.frames.Add(AnimKeyframe(0, 0, -4, 0))
|
||||||
|
|
|
@ -987,10 +987,12 @@ int fs_is_dir(const char *path)
|
||||||
|
|
||||||
int fs_chdir(const char *path)
|
int fs_chdir(const char *path)
|
||||||
{
|
{
|
||||||
if (fs_is_dir(path))
|
if(fs_is_dir(path))
|
||||||
{
|
{
|
||||||
chdir(path);
|
if(chdir(path))
|
||||||
return 0;
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1306,7 +1308,7 @@ void gui_messagebox(const char *title, const char *message)
|
||||||
title,
|
title,
|
||||||
message);
|
message);
|
||||||
|
|
||||||
system(cmd);
|
(void)system(cmd);
|
||||||
#elif defined(CONF_FAMILY_WINDOWS)
|
#elif defined(CONF_FAMILY_WINDOWS)
|
||||||
MessageBox(NULL,
|
MessageBox(NULL,
|
||||||
message,
|
message,
|
||||||
|
|
|
@ -624,7 +624,6 @@ void CServerBrowser::Update()
|
||||||
{
|
{
|
||||||
// timeout
|
// timeout
|
||||||
RemoveRequest(pEntry);
|
RemoveRequest(pEntry);
|
||||||
m_NumRequests--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pEntry = pNext;
|
pEntry = pNext;
|
||||||
|
@ -717,6 +716,10 @@ void CServerBrowser::RemoveFavorite(const NETADDR &Addr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CServerBrowser::IsRefreshing() const
|
||||||
|
{
|
||||||
|
return m_pFirstReqServer != 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool CServerBrowser::IsRefreshingMasters() const
|
bool CServerBrowser::IsRefreshingMasters() const
|
||||||
{
|
{
|
||||||
|
@ -724,6 +727,17 @@ bool CServerBrowser::IsRefreshingMasters() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int CServerBrowser::LoadingProgression() const
|
||||||
|
{
|
||||||
|
if(m_NumServers == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
int Servers = m_NumServers;
|
||||||
|
int Loaded = m_NumServers-m_NumRequests;
|
||||||
|
return 100.0f * Loaded/Servers;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CServerBrowser::ConfigSaveCallback(IConfig *pConfig, void *pUserData)
|
void CServerBrowser::ConfigSaveCallback(IConfig *pConfig, void *pUserData)
|
||||||
{
|
{
|
||||||
CServerBrowser *pSelf = (CServerBrowser *)pUserData;
|
CServerBrowser *pSelf = (CServerBrowser *)pUserData;
|
||||||
|
|
|
@ -29,7 +29,9 @@ public:
|
||||||
|
|
||||||
// interface functions
|
// interface functions
|
||||||
void Refresh(int Type);
|
void Refresh(int Type);
|
||||||
|
bool IsRefreshing() const;
|
||||||
bool IsRefreshingMasters() const;
|
bool IsRefreshingMasters() const;
|
||||||
|
int LoadingProgression() const;
|
||||||
|
|
||||||
int NumServers() const { return m_NumServers; }
|
int NumServers() const { return m_NumServers; }
|
||||||
|
|
||||||
|
|
|
@ -540,8 +540,8 @@ public:
|
||||||
int ActualSize;
|
int ActualSize;
|
||||||
int i;
|
int i;
|
||||||
int GotNewLine = 0;
|
int GotNewLine = 0;
|
||||||
float DrawX, DrawY;
|
float DrawX = 0.0f, DrawY = 0.0f;
|
||||||
int LineCount;
|
int LineCount = 0;
|
||||||
float CursorX, CursorY;
|
float CursorX, CursorY;
|
||||||
const char *pEnd;
|
const char *pEnd;
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,9 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void Refresh(int Type) = 0;
|
virtual void Refresh(int Type) = 0;
|
||||||
|
virtual bool IsRefreshing() const = 0;
|
||||||
virtual bool IsRefreshingMasters() const = 0;
|
virtual bool IsRefreshingMasters() const = 0;
|
||||||
|
virtual int LoadingProgression() const = 0;
|
||||||
|
|
||||||
virtual int NumServers() const = 0;
|
virtual int NumServers() const = 0;
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ public:
|
||||||
class IListner
|
class IListner
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
virtual ~IListner() {}
|
||||||
virtual void OnDemoPlayerSnapshot(void *pData, int Size) = 0;
|
virtual void OnDemoPlayerSnapshot(void *pData, int Size) = 0;
|
||||||
virtual void OnDemoPlayerMessage(void *pData, int Size) = 0;
|
virtual void OnDemoPlayerMessage(void *pData, int Size) = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -194,7 +194,6 @@ void CNetConnection::Disconnect(const char *pReason)
|
||||||
int CNetConnection::Feed(CNetPacketConstruct *pPacket, NETADDR *pAddr)
|
int CNetConnection::Feed(CNetPacketConstruct *pPacket, NETADDR *pAddr)
|
||||||
{
|
{
|
||||||
int64 Now = time_get();
|
int64 Now = time_get();
|
||||||
m_LastRecvTime = Now;
|
|
||||||
|
|
||||||
// check if resend is requested
|
// check if resend is requested
|
||||||
if(pPacket->m_Flags&NET_PACKETFLAG_RESEND)
|
if(pPacket->m_Flags&NET_PACKETFLAG_RESEND)
|
||||||
|
@ -256,27 +255,20 @@ int CNetConnection::Feed(CNetPacketConstruct *pPacket, NETADDR *pAddr)
|
||||||
// connection made
|
// connection made
|
||||||
if(CtrlMsg == NET_CTRLMSG_CONNECTACCEPT)
|
if(CtrlMsg == NET_CTRLMSG_CONNECTACCEPT)
|
||||||
{
|
{
|
||||||
|
m_LastRecvTime = Now;
|
||||||
SendControl(NET_CTRLMSG_ACCEPT, 0, 0);
|
SendControl(NET_CTRLMSG_ACCEPT, 0, 0);
|
||||||
m_State = NET_CONNSTATE_ONLINE;
|
m_State = NET_CONNSTATE_ONLINE;
|
||||||
if(g_Config.m_Debug)
|
if(g_Config.m_Debug)
|
||||||
dbg_msg("connection", "got connect+accept, sending accept. connection online");
|
dbg_msg("connection", "got connect+accept, sending accept. connection online");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(State() == NET_CONNSTATE_ONLINE)
|
|
||||||
{
|
|
||||||
// connection made
|
|
||||||
/*
|
|
||||||
if(ctrlmsg == NET_CTRLMSG_CONNECTACCEPT)
|
|
||||||
{
|
|
||||||
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(State() == NET_CONNSTATE_PENDING)
|
if(State() == NET_CONNSTATE_PENDING)
|
||||||
{
|
{
|
||||||
|
m_LastRecvTime = Now;
|
||||||
m_State = NET_CONNSTATE_ONLINE;
|
m_State = NET_CONNSTATE_ONLINE;
|
||||||
if(g_Config.m_Debug)
|
if(g_Config.m_Debug)
|
||||||
dbg_msg("connection", "connecting online");
|
dbg_msg("connection", "connecting online");
|
||||||
|
@ -285,6 +277,7 @@ int CNetConnection::Feed(CNetPacketConstruct *pPacket, NETADDR *pAddr)
|
||||||
|
|
||||||
if(State() == NET_CONNSTATE_ONLINE)
|
if(State() == NET_CONNSTATE_ONLINE)
|
||||||
{
|
{
|
||||||
|
m_LastRecvTime = Now;
|
||||||
AckChunks(pPacket->m_Ack);
|
AckChunks(pPacket->m_Ack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ CGameConsole::CInstance::CInstance(int Type)
|
||||||
|
|
||||||
m_Type = Type;
|
m_Type = Type;
|
||||||
|
|
||||||
if(Type == 0)
|
if(Type == CGameConsole::CONSOLETYPE_LOCAL)
|
||||||
m_CompletionFlagmask = CFGFLAG_CLIENT;
|
m_CompletionFlagmask = CFGFLAG_CLIENT;
|
||||||
else
|
else
|
||||||
m_CompletionFlagmask = CFGFLAG_SERVER;
|
m_CompletionFlagmask = CFGFLAG_SERVER;
|
||||||
|
@ -72,7 +72,7 @@ void CGameConsole::CInstance::ClearHistory()
|
||||||
|
|
||||||
void CGameConsole::CInstance::ExecuteLine(const char *pLine)
|
void CGameConsole::CInstance::ExecuteLine(const char *pLine)
|
||||||
{
|
{
|
||||||
if(m_Type == 0)
|
if(m_Type == CGameConsole::CONSOLETYPE_LOCAL)
|
||||||
m_pGameConsole->m_pConsole->ExecuteLine(pLine, 4, -1);
|
m_pGameConsole->m_pConsole->ExecuteLine(pLine, 4, -1);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -101,7 +101,7 @@ void CGameConsole::CInstance::OnInput(IInput::CEvent Event)
|
||||||
{
|
{
|
||||||
if(m_Input.GetString()[0])
|
if(m_Input.GetString()[0])
|
||||||
{
|
{
|
||||||
if(m_Type != 1 || m_pGameConsole->Client()->RconAuthed())
|
if(m_Type == CONSOLETYPE_LOCAL || m_pGameConsole->Client()->RconAuthed())
|
||||||
{
|
{
|
||||||
char *pEntry = m_History.Allocate(m_Input.GetLength()+1);
|
char *pEntry = m_History.Allocate(m_Input.GetLength()+1);
|
||||||
mem_copy(pEntry, m_Input.GetString(), m_Input.GetLength()+1);
|
mem_copy(pEntry, m_Input.GetString(), m_Input.GetLength()+1);
|
||||||
|
@ -150,7 +150,7 @@ void CGameConsole::CInstance::OnInput(IInput::CEvent Event)
|
||||||
}
|
}
|
||||||
else if(Event.m_Key == KEY_TAB)
|
else if(Event.m_Key == KEY_TAB)
|
||||||
{
|
{
|
||||||
if(m_Type == 0 || m_pGameConsole->Client()->RconAuthed())
|
if(m_Type == CGameConsole::CONSOLETYPE_LOCAL || m_pGameConsole->Client()->RconAuthed())
|
||||||
{
|
{
|
||||||
m_CompletionChosen++;
|
m_CompletionChosen++;
|
||||||
m_CompletionEnumerationCount = 0;
|
m_CompletionEnumerationCount = 0;
|
||||||
|
@ -216,9 +216,9 @@ void CGameConsole::CInstance::PrintLine(const char *pLine)
|
||||||
}
|
}
|
||||||
|
|
||||||
CGameConsole::CGameConsole()
|
CGameConsole::CGameConsole()
|
||||||
: m_LocalConsole(0), m_RemoteConsole(1)
|
: m_LocalConsole(CONSOLETYPE_LOCAL), m_RemoteConsole(CONSOLETYPE_REMOTE)
|
||||||
{
|
{
|
||||||
m_ConsoleType = 0;
|
m_ConsoleType = CONSOLETYPE_LOCAL;
|
||||||
m_ConsoleState = CONSOLE_CLOSED;
|
m_ConsoleState = CONSOLE_CLOSED;
|
||||||
m_StateChangeEnd = 0.0f;
|
m_StateChangeEnd = 0.0f;
|
||||||
m_StateChangeDuration = 0.1f;
|
m_StateChangeDuration = 0.1f;
|
||||||
|
@ -232,7 +232,7 @@ float CGameConsole::TimeNow()
|
||||||
|
|
||||||
CGameConsole::CInstance *CGameConsole::CurrentConsole()
|
CGameConsole::CInstance *CGameConsole::CurrentConsole()
|
||||||
{
|
{
|
||||||
if(m_ConsoleType != 0)
|
if(m_ConsoleType == CONSOLETYPE_REMOTE)
|
||||||
return &m_RemoteConsole;
|
return &m_RemoteConsole;
|
||||||
return &m_LocalConsole;
|
return &m_LocalConsole;
|
||||||
}
|
}
|
||||||
|
@ -324,7 +324,7 @@ void CGameConsole::OnRender()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_ConsoleState == CONSOLE_OPEN && g_Config.m_ClEditor)
|
if (m_ConsoleState == CONSOLE_OPEN && g_Config.m_ClEditor)
|
||||||
Toggle(0);
|
Toggle(CONSOLETYPE_LOCAL);
|
||||||
|
|
||||||
if (m_ConsoleState == CONSOLE_CLOSED)
|
if (m_ConsoleState == CONSOLE_CLOSED)
|
||||||
return;
|
return;
|
||||||
|
@ -362,7 +362,7 @@ void CGameConsole::OnRender()
|
||||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_CONSOLE_BG].m_Id);
|
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_CONSOLE_BG].m_Id);
|
||||||
Graphics()->QuadsBegin();
|
Graphics()->QuadsBegin();
|
||||||
Graphics()->SetColor(0.2f, 0.2f, 0.2f,0.9f);
|
Graphics()->SetColor(0.2f, 0.2f, 0.2f,0.9f);
|
||||||
if(m_ConsoleType != 0)
|
if(m_ConsoleType == CONSOLETYPE_REMOTE)
|
||||||
Graphics()->SetColor(0.4f, 0.2f, 0.2f,0.9f);
|
Graphics()->SetColor(0.4f, 0.2f, 0.2f,0.9f);
|
||||||
Graphics()->QuadsSetSubset(0,-ConsoleHeight*0.075f,Screen.w*0.075f*0.5f,0);
|
Graphics()->QuadsSetSubset(0,-ConsoleHeight*0.075f,Screen.w*0.075f*0.5f,0);
|
||||||
QuadItem = IGraphics::CQuadItem(0, 0, Screen.w, ConsoleHeight);
|
QuadItem = IGraphics::CQuadItem(0, 0, Screen.w, ConsoleHeight);
|
||||||
|
@ -414,7 +414,7 @@ void CGameConsole::OnRender()
|
||||||
TextRender()->SetCursor(&Info.m_Cursor, x+Info.m_Offset, y+12.0f, FontSize, TEXTFLAG_RENDER);
|
TextRender()->SetCursor(&Info.m_Cursor, x+Info.m_Offset, y+12.0f, FontSize, TEXTFLAG_RENDER);
|
||||||
|
|
||||||
const char *pPrompt = "> ";
|
const char *pPrompt = "> ";
|
||||||
if(m_ConsoleType)
|
if(m_ConsoleType == CONSOLETYPE_REMOTE)
|
||||||
{
|
{
|
||||||
if(Client()->State() == IClient::STATE_ONLINE)
|
if(Client()->State() == IClient::STATE_ONLINE)
|
||||||
{
|
{
|
||||||
|
@ -445,7 +445,7 @@ void CGameConsole::OnRender()
|
||||||
//hide rcon password
|
//hide rcon password
|
||||||
char aInputString[256];
|
char aInputString[256];
|
||||||
str_copy(aInputString, pConsole->m_Input.GetString(), sizeof(aInputString));
|
str_copy(aInputString, pConsole->m_Input.GetString(), sizeof(aInputString));
|
||||||
if(m_ConsoleType && Client()->State() == IClient::STATE_ONLINE && !Client()->RconAuthed())
|
if(m_ConsoleType == CONSOLETYPE_REMOTE && Client()->State() == IClient::STATE_ONLINE && !Client()->RconAuthed())
|
||||||
{
|
{
|
||||||
for(int i = 0; i < pConsole->m_Input.GetLength(); ++i)
|
for(int i = 0; i < pConsole->m_Input.GetLength(); ++i)
|
||||||
aInputString[i] = '*';
|
aInputString[i] = '*';
|
||||||
|
@ -457,7 +457,7 @@ void CGameConsole::OnRender()
|
||||||
TextRender()->TextEx(&Cursor, aInputString+pConsole->m_Input.GetCursorOffset(), -1);
|
TextRender()->TextEx(&Cursor, aInputString+pConsole->m_Input.GetCursorOffset(), -1);
|
||||||
|
|
||||||
// render possible commands
|
// render possible commands
|
||||||
if(m_ConsoleType == 0 || Client()->RconAuthed())
|
if(m_ConsoleType == CONSOLETYPE_LOCAL || Client()->RconAuthed())
|
||||||
{
|
{
|
||||||
if(pConsole->m_Input.GetString()[0] != 0)
|
if(pConsole->m_Input.GetString()[0] != 0)
|
||||||
{
|
{
|
||||||
|
@ -589,7 +589,7 @@ void CGameConsole::Toggle(int Type)
|
||||||
|
|
||||||
void CGameConsole::Dump(int Type)
|
void CGameConsole::Dump(int Type)
|
||||||
{
|
{
|
||||||
CInstance *pConsole = Type == 1 ? &m_RemoteConsole : &m_LocalConsole;
|
CInstance *pConsole = Type == CONSOLETYPE_REMOTE ? &m_RemoteConsole : &m_LocalConsole;
|
||||||
char aFilename[128];
|
char aFilename[128];
|
||||||
time_t Time;
|
time_t Time;
|
||||||
char aDate[20];
|
char aDate[20];
|
||||||
|
@ -601,7 +601,7 @@ void CGameConsole::Dump(int Type)
|
||||||
for(int i = 0; i < 10; i++)
|
for(int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
IOHANDLE io;
|
IOHANDLE io;
|
||||||
str_format(aFilename, sizeof(aFilename), "dumps/%s_dump%s-%05d.txt", Type==1?"remote_console":"local_console", aDate, i);
|
str_format(aFilename, sizeof(aFilename), "dumps/%s_dump%s-%05d.txt", Type==CONSOLETYPE_REMOTE?"remote_console":"local_console", aDate, i);
|
||||||
io = Storage()->OpenFile(aFilename, IOFLAG_WRITE, IStorage::TYPE_SAVE);
|
io = Storage()->OpenFile(aFilename, IOFLAG_WRITE, IStorage::TYPE_SAVE);
|
||||||
if(io)
|
if(io)
|
||||||
{
|
{
|
||||||
|
@ -624,12 +624,12 @@ void CGameConsole::Dump(int Type)
|
||||||
|
|
||||||
void CGameConsole::ConToggleLocalConsole(IConsole::IResult *pResult, void *pUserData, int ClientID)
|
void CGameConsole::ConToggleLocalConsole(IConsole::IResult *pResult, void *pUserData, int ClientID)
|
||||||
{
|
{
|
||||||
((CGameConsole *)pUserData)->Toggle(0);
|
((CGameConsole *)pUserData)->Toggle(CONSOLETYPE_LOCAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameConsole::ConToggleRemoteConsole(IConsole::IResult *pResult, void *pUserData, int ClientID)
|
void CGameConsole::ConToggleRemoteConsole(IConsole::IResult *pResult, void *pUserData, int ClientID)
|
||||||
{
|
{
|
||||||
((CGameConsole *)pUserData)->Toggle(1);
|
((CGameConsole *)pUserData)->Toggle(CONSOLETYPE_REMOTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameConsole::ConClearLocalConsole(IConsole::IResult *pResult, void *pUserData, int ClientID)
|
void CGameConsole::ConClearLocalConsole(IConsole::IResult *pResult, void *pUserData, int ClientID)
|
||||||
|
@ -644,12 +644,12 @@ void CGameConsole::ConClearRemoteConsole(IConsole::IResult *pResult, void *pUser
|
||||||
|
|
||||||
void CGameConsole::ConDumpLocalConsole(IConsole::IResult *pResult, void *pUserData, int ClientID)
|
void CGameConsole::ConDumpLocalConsole(IConsole::IResult *pResult, void *pUserData, int ClientID)
|
||||||
{
|
{
|
||||||
((CGameConsole *)pUserData)->Dump(0);
|
((CGameConsole *)pUserData)->Dump(CONSOLETYPE_LOCAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameConsole::ConDumpRemoteConsole(IConsole::IResult *pResult, void *pUserData, int ClientID)
|
void CGameConsole::ConDumpRemoteConsole(IConsole::IResult *pResult, void *pUserData, int ClientID)
|
||||||
{
|
{
|
||||||
((CGameConsole *)pUserData)->Dump(1);
|
((CGameConsole *)pUserData)->Dump(CONSOLETYPE_REMOTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameConsole::ClientConsolePrintCallback(const char *pStr, void *pUserData)
|
void CGameConsole::ClientConsolePrintCallback(const char *pStr, void *pUserData)
|
||||||
|
@ -659,9 +659,9 @@ void CGameConsole::ClientConsolePrintCallback(const char *pStr, void *pUserData)
|
||||||
|
|
||||||
void CGameConsole::PrintLine(int Type, const char *pLine)
|
void CGameConsole::PrintLine(int Type, const char *pLine)
|
||||||
{
|
{
|
||||||
if(Type == 0)
|
if(Type == CONSOLETYPE_LOCAL)
|
||||||
m_LocalConsole.PrintLine(pLine);
|
m_LocalConsole.PrintLine(pLine);
|
||||||
else if(Type == 1)
|
else if(Type == CONSOLETYPE_REMOTE)
|
||||||
m_RemoteConsole.PrintLine(pLine);
|
m_RemoteConsole.PrintLine(pLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,12 @@ class CGameConsole : public CComponent
|
||||||
static void ConDumpRemoteConsole(IConsole::IResult *pResult, void *pUserData, int ClientID);
|
static void ConDumpRemoteConsole(IConsole::IResult *pResult, void *pUserData, int ClientID);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
CONSOLETYPE_LOCAL=0,
|
||||||
|
CONSOLETYPE_REMOTE,
|
||||||
|
};
|
||||||
|
|
||||||
CGameConsole();
|
CGameConsole();
|
||||||
|
|
||||||
void PrintLine(int Type, const char *pLine);
|
void PrintLine(int Type, const char *pLine);
|
||||||
|
|
|
@ -112,12 +112,12 @@ vec4 CMenus::ButtonColorMul(const void *pID)
|
||||||
return vec4(1,1,1,1);
|
return vec4(1,1,1,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CMenus::DoButton_BrowseIcon(int What, const CUIRect *pRect)
|
int CMenus::DoButton_Icon(int ImageId, int SpriteId, const CUIRect *pRect)
|
||||||
{
|
{
|
||||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_BROWSEICONS].m_Id);
|
Graphics()->TextureSet(g_pData->m_aImages[ImageId].m_Id);
|
||||||
|
|
||||||
Graphics()->QuadsBegin();
|
Graphics()->QuadsBegin();
|
||||||
RenderTools()->SelectSprite(What);
|
RenderTools()->SelectSprite(SpriteId);
|
||||||
IGraphics::CQuadItem QuadItem(pRect->x, pRect->y, pRect->w, pRect->h);
|
IGraphics::CQuadItem QuadItem(pRect->x, pRect->y, pRect->w, pRect->h);
|
||||||
Graphics()->QuadsDrawTL(&QuadItem, 1);
|
Graphics()->QuadsDrawTL(&QuadItem, 1);
|
||||||
Graphics()->QuadsEnd();
|
Graphics()->QuadsEnd();
|
||||||
|
|
|
@ -47,7 +47,7 @@ class CMenus : public CComponent
|
||||||
static void ui_draw_settings_tab_button(const void *id, const char *text, int checked, const CUIRect *r, const void *extra);
|
static void ui_draw_settings_tab_button(const void *id, const char *text, int checked, const CUIRect *r, const void *extra);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int DoButton_BrowseIcon(int Checked, const CUIRect *pRect);
|
int DoButton_Icon(int ImageId, int SpriteId, const CUIRect *pRect);
|
||||||
int DoButton_GridHeader(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
|
int DoButton_GridHeader(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
|
||||||
|
|
||||||
//static void ui_draw_browse_icon(int what, const CUIRect *r);
|
//static void ui_draw_browse_icon(int what, const CUIRect *r);
|
||||||
|
|
|
@ -273,7 +273,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
||||||
if(Id == COL_FLAG_LOCK)
|
if(Id == COL_FLAG_LOCK)
|
||||||
{
|
{
|
||||||
if(pItem->m_Flags & SERVER_FLAG_PASSWORD)
|
if(pItem->m_Flags & SERVER_FLAG_PASSWORD)
|
||||||
DoButton_BrowseIcon(SPRITE_BROWSE_LOCK, &Button);
|
DoButton_Icon(IMAGE_BROWSEICONS, SPRITE_BROWSE_LOCK, &Button);
|
||||||
}
|
}
|
||||||
else if(Id == COL_FLAG_PURE)
|
else if(Id == COL_FLAG_PURE)
|
||||||
{
|
{
|
||||||
|
@ -286,13 +286,13 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// unpure
|
// unpure
|
||||||
DoButton_BrowseIcon(SPRITE_BROWSE_UNPURE, &Button);
|
DoButton_Icon(IMAGE_BROWSEICONS, SPRITE_BROWSE_UNPURE, &Button);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(Id == COL_FLAG_FAV)
|
else if(Id == COL_FLAG_FAV)
|
||||||
{
|
{
|
||||||
if(pItem->m_Favorite)
|
if(pItem->m_Favorite)
|
||||||
DoButton_BrowseIcon(SPRITE_BROWSE_HEART, &Button);
|
DoButton_Icon(IMAGE_BROWSEICONS, SPRITE_BROWSE_HEART, &Button);
|
||||||
}
|
}
|
||||||
else if(Id == COL_NAME)
|
else if(Id == COL_NAME)
|
||||||
{
|
{
|
||||||
|
@ -395,7 +395,10 @@ void CMenus::RenderServerbrowserServerList(CUIRect View)
|
||||||
|
|
||||||
// render status
|
// render status
|
||||||
char aBuf[128];
|
char aBuf[128];
|
||||||
str_format(aBuf, sizeof(aBuf), Localize("%d of %d servers, %d players"), ServerBrowser()->NumSortedServers(), ServerBrowser()->NumServers(), NumPlayers);
|
if(ServerBrowser()->IsRefreshing())
|
||||||
|
str_format(aBuf, sizeof(aBuf), Localize("%d%% loaded"), ServerBrowser()->LoadingProgression());
|
||||||
|
else
|
||||||
|
str_format(aBuf, sizeof(aBuf), Localize("%d of %d servers, %d players"), ServerBrowser()->NumSortedServers(), ServerBrowser()->NumServers(), NumPlayers);
|
||||||
Status.VSplitRight(TextRender()->TextWidth(0, 14.0f, aBuf, -1), 0, &Status);
|
Status.VSplitRight(TextRender()->TextWidth(0, 14.0f, aBuf, -1), 0, &Status);
|
||||||
UI()->DoLabel(&Status, aBuf, 14.0f, -1);
|
UI()->DoLabel(&Status, aBuf, 14.0f, -1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -442,7 +442,7 @@ void CMenus::DemolistFetchCallback(const char *pName, int IsDir, int StorageType
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
str_format(Item.m_aName, min(static_cast<int>(sizeof(Item.m_aName)), Length), " %s", pName);
|
str_copy(Item.m_aName, pName, min(static_cast<int>(sizeof(Item.m_aName)), Length));
|
||||||
char aBuffer[512];
|
char aBuffer[512];
|
||||||
str_format(aBuffer, sizeof(aBuffer), "%s/%s", pSelf->m_aCurrentDemoFolder, Item.m_aFilename);
|
str_format(aBuffer, sizeof(aBuffer), "%s/%s", pSelf->m_aCurrentDemoFolder, Item.m_aFilename);
|
||||||
// TODO: many items slow this down, don't load the info from every file when making the filelist
|
// TODO: many items slow this down, don't load the info from every file when making the filelist
|
||||||
|
@ -509,7 +509,7 @@ void CMenus::RenderDemoList(CUIRect MainView)
|
||||||
RenderTools()->DrawUIRect(&MainView, ms_ColorTabbarActive, CUI::CORNER_ALL, 10.0f);
|
RenderTools()->DrawUIRect(&MainView, ms_ColorTabbarActive, CUI::CORNER_ALL, 10.0f);
|
||||||
MainView.Margin(10.0f, &MainView);
|
MainView.Margin(10.0f, &MainView);
|
||||||
|
|
||||||
CUIRect ButtonBar, RefreshRect, PlayRect, DeleteRect;
|
CUIRect ButtonBar, RefreshRect, PlayRect, DeleteRect, FileIcon;
|
||||||
MainView.HSplitBottom(ms_ButtonHeight+5.0f, &MainView, &ButtonBar);
|
MainView.HSplitBottom(ms_ButtonHeight+5.0f, &MainView, &ButtonBar);
|
||||||
ButtonBar.HSplitTop(5.0f, 0, &ButtonBar);
|
ButtonBar.HSplitTop(5.0f, 0, &ButtonBar);
|
||||||
ButtonBar.VSplitRight(130.0f, &ButtonBar, &PlayRect);
|
ButtonBar.VSplitRight(130.0f, &ButtonBar, &PlayRect);
|
||||||
|
@ -524,7 +524,12 @@ void CMenus::RenderDemoList(CUIRect MainView)
|
||||||
{
|
{
|
||||||
CListboxItem Item = UiDoListboxNextItem((void*)(&r.front()));
|
CListboxItem Item = UiDoListboxNextItem((void*)(&r.front()));
|
||||||
if(Item.m_Visible)
|
if(Item.m_Visible)
|
||||||
|
{
|
||||||
|
Item.m_Rect.VSplitLeft(Item.m_Rect.h, &FileIcon, &Item.m_Rect);
|
||||||
|
Item.m_Rect.VSplitLeft(5.0f, 0, &Item.m_Rect);
|
||||||
|
DoButton_Icon(IMAGE_FILEICONS, r.front().m_IsDir?SPRITE_FILE_FOLDER:SPRITE_FILE_DEMO1, &FileIcon);
|
||||||
UI()->DoLabel(&Item.m_Rect, r.front().m_aName, Item.m_Rect.h*ms_FontmodHeight, -1);
|
UI()->DoLabel(&Item.m_Rect, r.front().m_aName, Item.m_Rect.h*ms_FontmodHeight, -1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
bool Activated = false;
|
bool Activated = false;
|
||||||
m_DemolistSelectedIndex = UiDoListboxEnd(&s_ScrollValue, &Activated);
|
m_DemolistSelectedIndex = UiDoListboxEnd(&s_ScrollValue, &Activated);
|
||||||
|
|
|
@ -192,7 +192,7 @@ void CGameClient::OnConsoleInit()
|
||||||
Console()->Register("tune", "si", CFGFLAG_SERVER, ConServerDummy, 0, "Tune variable to value", 0);
|
Console()->Register("tune", "si", CFGFLAG_SERVER, ConServerDummy, 0, "Tune variable to value", 0);
|
||||||
Console()->Register("tune_reset", "", CFGFLAG_SERVER, ConServerDummy, 0, "Reset tuning", 0);
|
Console()->Register("tune_reset", "", CFGFLAG_SERVER, ConServerDummy, 0, "Reset tuning", 0);
|
||||||
Console()->Register("tune_dump", "", CFGFLAG_SERVER, ConServerDummy, 0, "Dump tuning", 0);
|
Console()->Register("tune_dump", "", CFGFLAG_SERVER, ConServerDummy, 0, "Dump tuning", 0);
|
||||||
Console()->Register("change_map", "r", CFGFLAG_SERVER, ConServerDummy, 0, "Change map", 0);
|
Console()->Register("change_map", "?r", CFGFLAG_SERVER, ConServerDummy, 0, "Change map", 0);
|
||||||
Console()->Register("restart", "?i", CFGFLAG_SERVER, ConServerDummy, 0, "Restart in x seconds", 0);
|
Console()->Register("restart", "?i", CFGFLAG_SERVER, ConServerDummy, 0, "Restart in x seconds", 0);
|
||||||
Console()->Register("broadcast", "r", CFGFLAG_SERVER, ConServerDummy, 0, "Broadcast message", 0);
|
Console()->Register("broadcast", "r", CFGFLAG_SERVER, ConServerDummy, 0, "Broadcast message", 0);
|
||||||
Console()->Register("say", "r", CFGFLAG_SERVER, ConServerDummy, 0, "Say in chat", 0);
|
Console()->Register("say", "r", CFGFLAG_SERVER, ConServerDummy, 0, "Say in chat", 0);
|
||||||
|
@ -623,7 +623,7 @@ void CGameClient::OnEnterGame() {}
|
||||||
|
|
||||||
void CGameClient::OnRconLine(const char *pLine)
|
void CGameClient::OnRconLine(const char *pLine)
|
||||||
{
|
{
|
||||||
m_pGameConsole->PrintLine(1, pLine);
|
m_pGameConsole->PrintLine(CGameConsole::CONSOLETYPE_REMOTE, pLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameClient::ProcessEvents()
|
void CGameClient::ProcessEvents()
|
||||||
|
|
|
@ -25,7 +25,7 @@ public:
|
||||||
void Set(const char *pString);
|
void Set(const char *pString);
|
||||||
const char *GetString() const { return m_Str; }
|
const char *GetString() const { return m_Str; }
|
||||||
int GetLength() const { return m_Len; }
|
int GetLength() const { return m_Len; }
|
||||||
unsigned GetCursorOffset() const { return m_CursorPos; }
|
int GetCursorOffset() const { return m_CursorPos; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <game/client/ui.h>
|
#include <game/client/ui.h>
|
||||||
#include <game/gamecore.h>
|
#include <game/gamecore.h>
|
||||||
#include <game/client/render.h>
|
#include <game/client/render.h>
|
||||||
|
#include <game/generated/client_data.h>
|
||||||
|
|
||||||
#include "ed_editor.h"
|
#include "ed_editor.h"
|
||||||
#include <game/client/lineinput.h>
|
#include <game/client/lineinput.h>
|
||||||
|
@ -1910,22 +1911,6 @@ void CEditor::RenderLayers(CUIRect ToolBox, CUIRect ToolBar, CUIRect View)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ExtractName(const char *pFileName, char *pName, int BufferSize)
|
|
||||||
{
|
|
||||||
const char *pExtractedName = pFileName;
|
|
||||||
const char *pEnd = 0;
|
|
||||||
for(; *pFileName; ++pFileName)
|
|
||||||
{
|
|
||||||
if(*pFileName == '/' || *pFileName == '\\')
|
|
||||||
pExtractedName = pFileName+1;
|
|
||||||
else if(*pFileName == '.')
|
|
||||||
pEnd = pFileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Length = pEnd > pExtractedName ? min(BufferSize, (int)(pEnd-pExtractedName+1)) : BufferSize;
|
|
||||||
str_copy(pName, pExtractedName, Length);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CEditor::ReplaceImage(const char *pFileName, int StorageType, void *pUser)
|
void CEditor::ReplaceImage(const char *pFileName, int StorageType, void *pUser)
|
||||||
{
|
{
|
||||||
CEditor *pEditor = (CEditor *)pUser;
|
CEditor *pEditor = (CEditor *)pUser;
|
||||||
|
@ -1938,7 +1923,7 @@ void CEditor::ReplaceImage(const char *pFileName, int StorageType, void *pUser)
|
||||||
pEditor->Graphics()->UnloadTexture(pImg->m_TexId);
|
pEditor->Graphics()->UnloadTexture(pImg->m_TexId);
|
||||||
*pImg = ImgInfo;
|
*pImg = ImgInfo;
|
||||||
pImg->m_External = External;
|
pImg->m_External = External;
|
||||||
ExtractName(pFileName, pImg->m_aName, sizeof(pImg->m_aName));
|
pEditor->ExtractName(pFileName, pImg->m_aName, sizeof(pImg->m_aName));
|
||||||
pImg->m_TexId = pEditor->Graphics()->LoadTextureRaw(ImgInfo.m_Width, ImgInfo.m_Height, ImgInfo.m_Format, ImgInfo.m_pData, CImageInfo::FORMAT_AUTO, 0);
|
pImg->m_TexId = pEditor->Graphics()->LoadTextureRaw(ImgInfo.m_Width, ImgInfo.m_Height, ImgInfo.m_Format, ImgInfo.m_pData, CImageInfo::FORMAT_AUTO, 0);
|
||||||
pEditor->SortImages();
|
pEditor->SortImages();
|
||||||
for(int i = 0; i < pEditor->m_Map.m_lImages.size(); ++i)
|
for(int i = 0; i < pEditor->m_Map.m_lImages.size(); ++i)
|
||||||
|
@ -2203,8 +2188,8 @@ static void EditorListdirCallback(const char *pName, int IsDir, int StorageType,
|
||||||
int Length = str_length(pName);
|
int Length = str_length(pName);
|
||||||
if((pName[0] == '.' && (pName[1] == 0 ||
|
if((pName[0] == '.' && (pName[1] == 0 ||
|
||||||
(pName[1] == '.' && pName[2] == 0 && (!str_comp(pEditor->m_pFileDialogPath, "maps") || !str_comp(pEditor->m_pFileDialogPath, "mapres"))))) ||
|
(pName[1] == '.' && pName[2] == 0 && (!str_comp(pEditor->m_pFileDialogPath, "maps") || !str_comp(pEditor->m_pFileDialogPath, "mapres"))))) ||
|
||||||
(!IsDir && (pEditor->m_FileDialogFileType == CEditor::FILETYPE_MAP && (Length < 4 || str_comp(pName+Length-4, ".map"))) ||
|
(!IsDir && ((pEditor->m_FileDialogFileType == CEditor::FILETYPE_MAP && (Length < 4 || str_comp(pName+Length-4, ".map"))) ||
|
||||||
(pEditor->m_FileDialogFileType == CEditor::FILETYPE_IMG && (Length < 4 || str_comp(pName+Length-4, ".png")))))
|
(pEditor->m_FileDialogFileType == CEditor::FILETYPE_IMG && (Length < 4 || str_comp(pName+Length-4, ".png"))))))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CEditor::CFilelistItem Item;
|
CEditor::CFilelistItem Item;
|
||||||
|
@ -2212,7 +2197,7 @@ static void EditorListdirCallback(const char *pName, int IsDir, int StorageType,
|
||||||
if(IsDir)
|
if(IsDir)
|
||||||
str_format(Item.m_aName, sizeof(Item.m_aName), "%s/", pName);
|
str_format(Item.m_aName, sizeof(Item.m_aName), "%s/", pName);
|
||||||
else
|
else
|
||||||
str_format(Item.m_aName, min(static_cast<int>(sizeof(Item.m_aName)), Length+1), " %s", pName);
|
str_copy(Item.m_aName, pName, min(static_cast<int>(sizeof(Item.m_aName)), Length+1));
|
||||||
Item.m_IsDir = IsDir != 0;
|
Item.m_IsDir = IsDir != 0;
|
||||||
Item.m_IsLink = false;
|
Item.m_IsLink = false;
|
||||||
Item.m_StorageType = StorageType;
|
Item.m_StorageType = StorageType;
|
||||||
|
@ -2225,9 +2210,18 @@ void CEditor::AddFileDialogEntry(int Index, CUIRect *pView)
|
||||||
if(m_FilesCur-1 < m_FilesStartAt || m_FilesCur >= m_FilesStopAt)
|
if(m_FilesCur-1 < m_FilesStartAt || m_FilesCur >= m_FilesStopAt)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CUIRect Button;
|
CUIRect Button, FileIcon;
|
||||||
pView->HSplitTop(15.0f, &Button, pView);
|
pView->HSplitTop(15.0f, &Button, pView);
|
||||||
pView->HSplitTop(2.0f, 0, pView);
|
pView->HSplitTop(2.0f, 0, pView);
|
||||||
|
Button.VSplitLeft(Button.h, &FileIcon, &Button);
|
||||||
|
Button.VSplitLeft(5.0f, 0, &Button);
|
||||||
|
|
||||||
|
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_FILEICONS].m_Id);
|
||||||
|
Graphics()->QuadsBegin();
|
||||||
|
RenderTools()->SelectSprite(m_FileList[Index].m_IsDir?SPRITE_FILE_FOLDER:SPRITE_FILE_MAP2);
|
||||||
|
IGraphics::CQuadItem QuadItem(FileIcon.x, FileIcon.y, FileIcon.w, FileIcon.h);
|
||||||
|
Graphics()->QuadsDrawTL(&QuadItem, 1);
|
||||||
|
Graphics()->QuadsEnd();
|
||||||
|
|
||||||
if(DoButton_File((void*)(10+(int)Button.y), m_FileList[Index].m_aName, m_FilesSelectedIndex == Index, &Button, 0, 0))
|
if(DoButton_File((void*)(10+(int)Button.y), m_FileList[Index].m_aName, m_FilesSelectedIndex == Index, &Button, 0, 0))
|
||||||
{
|
{
|
||||||
|
|
|
@ -762,6 +762,21 @@ public:
|
||||||
|
|
||||||
void AddFileDialogEntry(int Index, CUIRect *pView);
|
void AddFileDialogEntry(int Index, CUIRect *pView);
|
||||||
void SortImages();
|
void SortImages();
|
||||||
|
static void ExtractName(const char *pFileName, char *pName, int BufferSize)
|
||||||
|
{
|
||||||
|
const char *pExtractedName = pFileName;
|
||||||
|
const char *pEnd = 0;
|
||||||
|
for(; *pFileName; ++pFileName)
|
||||||
|
{
|
||||||
|
if(*pFileName == '/' || *pFileName == '\\')
|
||||||
|
pExtractedName = pFileName+1;
|
||||||
|
else if(*pFileName == '.')
|
||||||
|
pEnd = pFileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
int Length = pEnd > pExtractedName ? min(BufferSize, (int)(pEnd-pExtractedName+1)) : BufferSize;
|
||||||
|
str_copy(pName, pExtractedName, Length);
|
||||||
|
}
|
||||||
|
|
||||||
unsigned char m_TeleNum;
|
unsigned char m_TeleNum;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
|
#include <engine/client.h>
|
||||||
#include <engine/console.h>
|
#include <engine/console.h>
|
||||||
#include <engine/graphics.h>
|
#include <engine/graphics.h>
|
||||||
|
#include <engine/serverbrowser.h>
|
||||||
#include <engine/storage.h>
|
#include <engine/storage.h>
|
||||||
#include <game/gamecore.h>
|
#include <game/gamecore.h>
|
||||||
#include "ed_editor.h"
|
#include "ed_editor.h"
|
||||||
|
@ -401,11 +403,15 @@ int CEditorMap::Save(class IStorage *pStorage, const char *pFileName)
|
||||||
m_pEditor->Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "editor", "saving done");
|
m_pEditor->Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "editor", "saving done");
|
||||||
|
|
||||||
// send rcon.. if we can
|
// send rcon.. if we can
|
||||||
/*
|
if(m_pEditor->Client()->RconAuthed())
|
||||||
if(Client()->RconAuthed())
|
|
||||||
{
|
{
|
||||||
Client()->Rcon("sv_map_reload 1");
|
CServerInfo CurrentServerInfo;
|
||||||
}*/
|
m_pEditor->Client()->GetServerInfo(&CurrentServerInfo);
|
||||||
|
char aMapName[128];
|
||||||
|
m_pEditor->ExtractName(pFileName, aMapName, sizeof(aMapName));
|
||||||
|
if(!str_comp(aMapName, CurrentServerInfo.m_aMap))
|
||||||
|
m_pEditor->Client()->Rcon("reload");
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ void CGameContext::ConTuneDump(IConsole::IResult *pResult, void *pUserData, int
|
||||||
void CGameContext::ConChangeMap(IConsole::IResult *pResult, void *pUserData, int ClientId)
|
void CGameContext::ConChangeMap(IConsole::IResult *pResult, void *pUserData, int ClientId)
|
||||||
{
|
{
|
||||||
CGameContext *pSelf = (CGameContext *)pUserData;
|
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||||
pSelf->m_pController->ChangeMap(pResult->GetString(0));
|
pSelf->m_pController->ChangeMap(pResult->NumArguments() ? pResult->GetString(0) : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGameContext::ConRestart(IConsole::IResult *pResult, void *pUserData, int ClientId)
|
void CGameContext::ConRestart(IConsole::IResult *pResult, void *pUserData, int ClientId)
|
||||||
|
|
|
@ -1125,7 +1125,7 @@ void CGameContext::OnConsoleInit()
|
||||||
m_pServer = Kernel()->RequestInterface<IServer>();
|
m_pServer = Kernel()->RequestInterface<IServer>();
|
||||||
m_pConsole = Kernel()->RequestInterface<IConsole>();
|
m_pConsole = Kernel()->RequestInterface<IConsole>();
|
||||||
|
|
||||||
Console()->Register("change_map", "r", CFGFLAG_SERVER, ConChangeMap, this, "Changes the map to r", 3);
|
Console()->Register("change_map", "?r", CFGFLAG_SERVER, ConChangeMap, this, "Changes the map to r", 3);
|
||||||
Console()->Register("restart", "?i", CFGFLAG_SERVER, ConRestart, this, "Kills all players", 3);
|
Console()->Register("restart", "?i", CFGFLAG_SERVER, ConRestart, this, "Kills all players", 3);
|
||||||
Console()->Register("broadcast", "r", CFGFLAG_SERVER, ConBroadcast, this, "Changes the broadcast message for a moment", 3);
|
Console()->Register("broadcast", "r", CFGFLAG_SERVER, ConBroadcast, this, "Changes the broadcast message for a moment", 3);
|
||||||
Console()->Register("say", "r", CFGFLAG_SERVER, ConSay, this, "Sends a server message to all players", 3);
|
Console()->Register("say", "r", CFGFLAG_SERVER, ConSay, this, "Sends a server message to all players", 3);
|
||||||
|
|
Loading…
Reference in a new issue