Merge branch 'master' into sqlmasters

This commit is contained in:
H-M-H 2016-05-20 23:40:29 +02:00
commit b648b530d5
41 changed files with 348 additions and 210 deletions

1
.gitignore vendored
View file

@ -20,6 +20,7 @@ mastersrv*
packetgen*
teeworlds*
teeworlds_srv*
serverlaunch_*
tileset_border*
twping*
versionsrv*

View file

@ -1,11 +1,11 @@
[![DDraceNetwork](http://ddnet.tw/ddnet-small.png)](http://ddnet.tw) [![Build Status](https://circleci.com/gh/ddnet/ddnet/tree/master.png)](https://circleci.com/gh/ddnet/ddnet)
[![DDraceNetwork](https://ddnet.tw/ddnet-small.png)](https://ddnet.tw) [![Build Status](https://circleci.com/gh/ddnet/ddnet/tree/master.png)](https://circleci.com/gh/ddnet/ddnet)
================================
Our own flavor of DDRace, a Teeworlds mod. See the [website](http://ddnet.tw) for more information.
Our own flavor of DDRace, a Teeworlds mod. See the [website](https://ddnet.tw) for more information.
Development discussions happen on #ddnet on Quakenet ([Webchat](http://webchat.quakenet.org/?channels=ddnet&uio=d4)).
You can get binary releases on the [DDNet website](http://ddnet.tw/downloads/).
You can get binary releases on the [DDNet website](https://ddnet.tw/downloads/).
Building
--------
@ -14,7 +14,7 @@ To compile DDNet yourself, you can follow the [instructions for compiling Teewor
DDNet requires additional libraries, that are bundled for the most common platforms (Windows, Mac, Linux, all x86 and x86_64). Instead you can install these libraries on your system, remove the `config.lua` and `bam` should use the system-wide libraries by default. You can install all required dependencies on Debian and Ubuntu like this:
apt-get install libsdl1.2-dev libfreetype6-dev libcurl4-openssl-dev libogg-dev libopus-dev libopusfile-dev
apt-get install libsdl2-dev libfreetype6-dev libcurl4-openssl-dev libogg-dev libopus-dev libopusfile-dev
If you have the libraries installed, but still want to use the bundled ones instead, you can specify so by running `bam config curl.use_pkgconfig=false opus.use_pkgconfig=false opusfile.use_pkgconfig=false ogg.use_pkgconfig=false`.

View file

@ -1,7 +1,7 @@
#
# autoexec_server.cfg
#
# See http://ddnet.tw/settingscommands for all available settings.
# See https://ddnet.tw/settingscommands/ for all available settings.
# Everything following a # is considered a comment and ignored by the server.
# When an option can be enabled or disabled, it's enabled with 1, disabled with 0.
#

View file

@ -156,6 +156,8 @@ if use_bundle:
<string>%s</string>
<key>CFBundleIdentifier</key>
<string>org.DDNetClient.app</string>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>
""" % (version))

View file

@ -41,6 +41,7 @@ protected:
public:
int m_LocalIDs[2];
char m_aNews[NEWS_SIZE];
int64 m_ReconnectTime;
CNetObj_PlayerInput m_DummyInput;
@ -139,6 +140,8 @@ public:
virtual void CheckVersionUpdate() = 0;
virtual int GetPredictionTime() = 0;
// snapshot interface
enum

View file

@ -568,7 +568,8 @@ int CGraphicsBackend_SDL_OpenGL::Init(const char *pName, int *Screen, int *pWidt
m_NumScreens = SDL_GetNumVideoDisplays();
if(m_NumScreens > 0)
{
clamp(*Screen, 0, m_NumScreens-1);
if(*Screen < 0 || *Screen >= m_NumScreens)
*Screen = 0;
if(SDL_GetDisplayBounds(*Screen, &ScreenPos) != 0)
{
dbg_msg("gfx", "unable to retrieve screen information: %s", SDL_GetError());
@ -620,6 +621,11 @@ int CGraphicsBackend_SDL_OpenGL::Init(const char *pName, int *Screen, int *pWidt
#endif
}
if(Flags&IGraphicsBackend::INITFLAG_HIGHDPI)
SdlFlags |= SDL_WINDOW_ALLOW_HIGHDPI;
else
SDL_SetHint(SDL_HINT_VIDEO_HIGHDPI_DISABLED, "1");
// set gl attributes
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
if(FsaaSamples)
@ -633,13 +639,13 @@ int CGraphicsBackend_SDL_OpenGL::Init(const char *pName, int *Screen, int *pWidt
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0);
}
// Might fix problems with Windows HighDPI scaling
SDL_SetHint(SDL_HINT_VIDEO_HIGHDPI_DISABLED, "1");
if(g_Config.m_InpMouseOld)
SDL_SetHint(SDL_HINT_MOUSE_RELATIVE_MODE_WARP, "1");
m_pWindow = SDL_CreateWindow(
pName,
SDL_WINDOWPOS_CENTERED_DISPLAY(g_Config.m_GfxScreen),
SDL_WINDOWPOS_CENTERED_DISPLAY(g_Config.m_GfxScreen),
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
*pWidth,
*pHeight,
SdlFlags);
@ -651,8 +657,6 @@ int CGraphicsBackend_SDL_OpenGL::Init(const char *pName, int *Screen, int *pWidt
return -1;
}
SDL_GetWindowSize(m_pWindow, pWidth, pHeight);
m_GLContext = SDL_GL_CreateContext(m_pWindow);
if(m_GLContext == NULL)
@ -661,12 +665,8 @@ int CGraphicsBackend_SDL_OpenGL::Init(const char *pName, int *Screen, int *pWidt
return -1;
}
SDL_ShowWindow(m_pWindow);
SetWindowScreen(g_Config.m_GfxScreen);
SDL_GL_GetDrawableSize(m_pWindow, pWidth, pHeight);
SDL_GL_SetSwapInterval(Flags&IGraphicsBackend::INITFLAG_VSYNC ? 1 : 0);
SDL_GL_MakeCurrent(NULL, NULL);
// start the command processor
@ -685,6 +685,9 @@ int CGraphicsBackend_SDL_OpenGL::Init(const char *pName, int *Screen, int *pWidt
RunBuffer(&CmdBuffer);
WaitForIdle();
SDL_ShowWindow(m_pWindow);
SetWindowScreen(g_Config.m_GfxScreen);
// return
return 0;
}

View file

@ -345,6 +345,7 @@ CClient::CClient() : m_DemoPlayer(&m_SnapshotDelta)
m_LastDummyConnectTime = 0;
m_DDNetSrvListTokenSet = false;
m_ReconnectTime = 0;
}
// ----- send functions -----
@ -622,7 +623,17 @@ void CClient::SetState(int s)
}
m_State = s;
if(Old != s)
{
GameClient()->OnStateChange(m_State, Old);
if(s == IClient::STATE_OFFLINE && m_ReconnectTime == 0)
{
if(g_Config.m_ClReconnectFull > 0 && (str_find_nocase(ErrorString(), "full") || str_find_nocase(ErrorString(), "reserved")))
m_ReconnectTime = time_get() + time_freq() * g_Config.m_ClReconnectFull;
else if(g_Config.m_ClReconnectTimeout > 0 && str_find_nocase(ErrorString(), "Timeout"))
m_ReconnectTime = time_get() + time_freq() * g_Config.m_ClReconnectTimeout;
}
}
}
// called when the map is loaded and we should init for a new round
@ -922,7 +933,6 @@ void CClient::DebugRender()
static NETSTATS Prev, Current;
static int64 LastSnap = 0;
static float FrameTimeAvg = 0;
int64 Now = time_get();
char aBuffer[512];
if(!g_Config.m_Debug)
@ -988,8 +998,7 @@ void CClient::DebugRender()
}
}
str_format(aBuffer, sizeof(aBuffer), "pred: %d ms",
(int)((m_PredictedTime.Get(Now)-m_GameTime[g_Config.m_ClDummy].Get(Now))*1000/(float)time_freq()));
str_format(aBuffer, sizeof(aBuffer), "pred: %d ms", GetPredictionTime());
Graphics()->QuadsText(2, 70, 16, aBuffer);
Graphics()->QuadsEnd();
@ -1224,6 +1233,7 @@ void CClient::ProcessConnlessPacket(CNetChunk *pPacket)
// do decompression of serverlist
if (uncompress((Bytef*)aBuf, &DstLen, (Bytef*)pComp, CompLength) == Z_OK && (int)DstLen == PlainLength)
{
aBuf[DstLen] = '\0';
bool ListChanged = true;
IOHANDLE File = m_pStorage->OpenFile("ddnet-servers.json", IOFLAG_READ, IStorage::TYPE_SAVE);
@ -2467,6 +2477,12 @@ void CClient::Update()
// update gameclient
if(!m_EditorActive)
GameClient()->OnUpdate();
if(m_ReconnectTime > 0 && time_get() > m_ReconnectTime)
{
Connect(m_aServerAddressStr);
m_ReconnectTime = 0;
}
}
void CClient::VersionUpdate()
@ -2743,13 +2759,15 @@ void CClient::Run()
m_EditorActive = false;
Update();
int64 Now = time_get();
if((g_Config.m_GfxBackgroundRender || m_pGraphics->WindowOpen()) && (!g_Config.m_GfxAsyncRenderOld || m_pGraphics->IsIdle()))
if((g_Config.m_GfxBackgroundRender || m_pGraphics->WindowOpen())
&& (!g_Config.m_GfxAsyncRenderOld || m_pGraphics->IsIdle())
&& (!g_Config.m_GfxRefreshRate || Now >= m_LastRenderTime + time_freq() / g_Config.m_GfxRefreshRate))
{
m_RenderFrames++;
// update frametime
int64 Now = time_get();
m_RenderFrameTime = (Now - m_LastRenderTime) / (float)time_freq();
if(m_RenderFrameTime < m_RenderFrameTimeLow)
m_RenderFrameTimeLow = m_RenderFrameTime;
@ -3531,3 +3549,9 @@ void CClient::RequestDDNetSrvList()
Packet.m_Flags = NETSENDFLAG_CONNLESS;
m_NetClient[g_Config.m_ClDummy].Send(&Packet);
}
int CClient::GetPredictionTime()
{
int64 Now = time_get();
return (int)((m_PredictedTime.Get(Now)-m_GameTime[g_Config.m_ClDummy].Get(Now))*1000/(float)time_freq());
}

View file

@ -270,6 +270,7 @@ public:
// ---
int GetPredictionTime();
void *SnapGetItem(int SnapID, int Index, CSnapItem *pItem);
void SnapInvalidateItem(int SnapID, int Index);
void *SnapFindItem(int SnapID, int Type, int ID);

View file

@ -787,6 +787,7 @@ int CGraphics_Threaded::IssueInit()
if(g_Config.m_GfxFullscreen) Flags |= IGraphicsBackend::INITFLAG_FULLSCREEN;
if(g_Config.m_GfxVsync) Flags |= IGraphicsBackend::INITFLAG_VSYNC;
if(g_Config.m_GfxResizable) Flags |= IGraphicsBackend::INITFLAG_RESIZABLE;
if(g_Config.m_GfxHighdpi) Flags |= IGraphicsBackend::INITFLAG_HIGHDPI;
return m_pBackend->Init("DDNet Client", &g_Config.m_GfxScreen, &g_Config.m_GfxScreenWidth, &g_Config.m_GfxScreenHeight, g_Config.m_GfxFsaaSamples, Flags, &m_DesktopScreenWidth, &m_DesktopScreenHeight);
}

View file

@ -318,6 +318,7 @@ public:
INITFLAG_VSYNC = 2,
INITFLAG_RESIZABLE = 4,
INITFLAG_BORDERLESS = 8,
INITFLAG_HIGHDPI = 16,
};
virtual ~IGraphicsBackend() {}

View file

@ -249,7 +249,12 @@ int CInput::Update()
case SDL_WINDOWEVENT_FOCUS_LOST:
m_MouseFocus = false;
IgnoreKeys = true;
SDL_SetRelativeMouseMode(SDL_FALSE);
if(m_InputGrabbed)
{
MouseModeAbsolute();
// Remember that we had relative mouse
m_InputGrabbed = true;
}
break;
#if defined(CONF_PLATFORM_MACOSX) // Todo: remove this when fixed in SDL
case SDL_WINDOWEVENT_MAXIMIZED:

View file

@ -1066,6 +1066,7 @@ bool CServerBrowser::DDNetFiltered(char *pFilter, const char *pName)
void CServerBrowser::DDNetCountryFilterClean()
{
char aNewList[128];
aNewList[0] = '\0';
for(int i = 0; i < m_NumDDNetCountries; i++)
{
@ -1084,6 +1085,7 @@ void CServerBrowser::DDNetCountryFilterClean()
void CServerBrowser::DDNetTypeFilterClean()
{
char aNewList[128];
aNewList[0] = '\0';
for(int i = 0; i < m_NumDDNetTypes; i++)
{

View file

@ -112,7 +112,7 @@ MACRO_CONFIG_INT(GfxHighDetail, gfx_high_detail, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_C
MACRO_CONFIG_INT(GfxTextureQuality, gfx_texture_quality, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "")
#endif
MACRO_CONFIG_INT(GfxFsaaSamples, gfx_fsaa_samples, 0, 0, 16, CFGFLAG_SAVE|CFGFLAG_CLIENT, "FSAA Samples")
MACRO_CONFIG_INT(GfxRefreshRate, gfx_refresh_rate, 0, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Screen refresh rate")
MACRO_CONFIG_INT(GfxRefreshRate, gfx_refresh_rate, 0, 0, 1000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Screen refresh rate")
MACRO_CONFIG_INT(GfxFinish, gfx_finish, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "")
MACRO_CONFIG_INT(GfxBackgroundRender, gfx_backgroundrender, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Render graphics when window is in background")
MACRO_CONFIG_INT(GfxTextOverlay, gfx_text_overlay, 10, 1, 100, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Stop rendering textoverlay in editor or with entities: high value = less details = more speed")
@ -127,8 +127,10 @@ MACRO_CONFIG_INT(GfxQuadAsTriangle, gfx_quad_as_triangle, 0, 0, 0, CFGFLAG_SAVE|
#else
MACRO_CONFIG_INT(GfxQuadAsTriangle, gfx_quad_as_triangle, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Render quads as triangles (fixes quad coloring on some GPUs)")
#endif
MACRO_CONFIG_INT(GfxHighdpi, gfx_highdpi, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Try to use high-dpi screen features")
MACRO_CONFIG_INT(InpMousesens, inp_mousesens, 100, 5, 100000, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Mouse sensitivity")
MACRO_CONFIG_INT(InpMouseOld, inp_mouseold, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Use old mouse mode (warp mouse instead of raw input)")
MACRO_CONFIG_INT(InpIgnoredModifiers, inp_ignored_modifiers, 0, 0, 65536, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Ignored keyboard modifier mask")
MACRO_CONFIG_STR(SvName, sv_name, 128, "unnamed server", CFGFLAG_SERVER, "Server name")

View file

@ -5,15 +5,15 @@
#include <engine/shared/config.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
void CFifo::Init(IConsole *pConsole, char *pFifoFile, int Flag)
{
m_File = NULL;
m_File = -1;
m_pConsole = pConsole;
if(pFifoFile[0] == '\0')
@ -40,31 +40,37 @@ void CFifo::Init(IConsole *pConsole, char *pFifoFile, int Flag)
}
}
int fileFD = open(pFifoFile, O_RDONLY|O_NONBLOCK);
if(fileFD >= 0)
m_File = fdopen(fileFD, "r");
if(m_File == NULL)
m_File = open(pFifoFile, O_RDONLY|O_NONBLOCK);
if(m_File < 0)
dbg_msg("fifo", "can't open file '%s'", pFifoFile);
}
void CFifo::Shutdown()
{
if(m_File)
fclose(m_File);
if(m_File >= 0)
close(m_File);
}
void CFifo::Update()
{
if(m_File == NULL)
if(m_File < 0)
return;
char aBuf[8192];
int Length = read(m_File, aBuf, sizeof(aBuf));
if(Length <= 0)
return;
while(true)
char *pCur = aBuf;
for(int i = 0; i < Length; ++i)
{
char *pResult = fgets(aBuf, sizeof(aBuf), m_File);
if(pResult == NULL) break;
m_pConsole->ExecuteLineFlag(pResult, m_Flag, -1);
if(aBuf[i] != '\n')
continue;
aBuf[i] = '\0';
m_pConsole->ExecuteLineFlag(pCur, m_Flag, -1);
pCur = aBuf+i+1;
}
if(pCur < aBuf+Length) // missed the last line
m_pConsole->ExecuteLineFlag(pCur, m_Flag, -1);
}
#endif

View file

@ -5,13 +5,11 @@
#if defined(CONF_FAMILY_UNIX)
#include <stdio.h> // FILE
class CFifo
{
IConsole *m_pConsole;
int m_Flag;
FILE *m_File;
int m_File;
public:
void Init(IConsole *pConsole, char *pFifoFile, int Flag);

View file

@ -220,7 +220,9 @@ public:
int AckSequence() const { return m_Ack; }
int SeqSequence() const { return m_Sequence; }
int SecurityToken() const { return m_SecurityToken; }
void SetTimedOut(const NETADDR *pAddr, int Sequence, int Ack, SECURITY_TOKEN SecurityToken);
TStaticRingBuffer<CNetChunkResend, NET_CONN_BUFFERSIZE> *ResendBuffer() { return &m_Buffer; };
void SetTimedOut(const NETADDR *pAddr, int Sequence, int Ack, SECURITY_TOKEN SecurityToken, TStaticRingBuffer<CNetChunkResend, NET_CONN_BUFFERSIZE> *pResendBuffer);
// anti spoof
void DirectInit(NETADDR &Addr, SECURITY_TOKEN SecurityToken);

View file

@ -467,7 +467,7 @@ int CNetConnection::Update()
return 0;
}
void CNetConnection::SetTimedOut(const NETADDR *pAddr, int Sequence, int Ack, SECURITY_TOKEN SecurityToken)
void CNetConnection::SetTimedOut(const NETADDR *pAddr, int Sequence, int Ack, SECURITY_TOKEN SecurityToken, TStaticRingBuffer<CNetChunkResend, NET_CONN_BUFFERSIZE> *pResendBuffer)
{
int64 Now = time_get();
@ -482,5 +482,16 @@ void CNetConnection::SetTimedOut(const NETADDR *pAddr, int Sequence, int Ack, SE
m_LastRecvTime = Now;
m_LastUpdateTime = Now;
m_SecurityToken = SecurityToken;
// copy resend buffer
m_Buffer.Init();
while (pResendBuffer->First())
{
CNetChunkResend *First = pResendBuffer->First();
CNetChunkResend *pResend = m_Buffer.Allocate(sizeof(CNetChunkResend)+First->m_DataSize);
mem_copy(pResend, First, sizeof(CNetChunkResend)+First->m_DataSize);
pResendBuffer->PopFirst();
}
}

View file

@ -596,7 +596,7 @@ int CNetServer::Recv(CNetChunk *pChunk)
// drop invalid ctrl packets
if (m_RecvUnpacker.m_Data.m_Flags&NET_PACKETFLAG_CONTROL &&
m_RecvUnpacker.m_Data.m_DataSize == 0)
return 0;
continue;
// normal packet, find matching slot
int Slot = GetClientSlot(Addr);
@ -684,7 +684,7 @@ bool CNetServer::SetTimedOut(int ClientID, int OrigID)
if (m_aSlots[ClientID].m_Connection.State() != NET_CONNSTATE_ERROR)
return false;
m_aSlots[ClientID].m_Connection.SetTimedOut(ClientAddr(OrigID), m_aSlots[OrigID].m_Connection.SeqSequence(), m_aSlots[OrigID].m_Connection.AckSequence(), m_aSlots[OrigID].m_Connection.SecurityToken());
m_aSlots[ClientID].m_Connection.SetTimedOut(ClientAddr(OrigID), m_aSlots[OrigID].m_Connection.SeqSequence(), m_aSlots[OrigID].m_Connection.AckSequence(), m_aSlots[OrigID].m_Connection.SecurityToken(), m_aSlots[OrigID].m_Connection.ResendBuffer());
m_aSlots[OrigID].m_Connection.Reset();
return true;
}

View file

@ -127,18 +127,14 @@ bool CChat::OnInput(IInput::CEvent Event)
{
if(Text[i] == '\n')
{
int max = i - Begin + 1;
if(max > (int)sizeof(Line))
max = sizeof(Line);
int max = min(i - Begin + 1, (int)sizeof(Line));
str_copy(Line, Text + Begin, max);
Begin = i+1;
SayChat(Line);
while(Text[i] == '\n') i++;
}
}
int max = i - Begin + 1;
if(max > (int)sizeof(Line))
max = sizeof(Line);
int max = min(i - Begin + 1, (int)sizeof(Line));
str_copy(Line, Text + Begin, max);
Begin = i+1;
m_Input.Add(Line);
@ -150,6 +146,35 @@ bool CChat::OnInput(IInput::CEvent Event)
Input()->SetClipboardText(m_Input.GetString());
}
if(Input()->KeyIsPressed(KEY_LCTRL)) // jump to spaces and special ASCII characters
{
int SearchDirection = 0;
if(Input()->KeyPress(KEY_LEFT))
SearchDirection = -1;
else if(Input()->KeyPress(KEY_RIGHT))
SearchDirection = 1;
if(SearchDirection != 0)
{
int FoundAt = SearchDirection > 0 ? m_Input.GetLength()-1 : 0;
for(int i = m_Input.GetCursorOffset()+SearchDirection; SearchDirection > 0 ? i < m_Input.GetLength()-1 : i > 0; i+=SearchDirection)
{
int next = i+SearchDirection;
if( (m_Input.GetString()[next] == ' ') ||
(m_Input.GetString()[next] >= 32 && m_Input.GetString()[next] <= 47) ||
(m_Input.GetString()[next] >= 58 && m_Input.GetString()[next] <= 64) ||
(m_Input.GetString()[next] >= 91 && m_Input.GetString()[next] <= 96) )
{
FoundAt = i;
if(SearchDirection < 0)
FoundAt++;
break;
}
}
m_Input.SetCursorOffset(FoundAt);
}
}
if(Event.m_Flags&IInput::FLAG_PRESS && Event.m_Key == KEY_ESCAPE)
{
m_Mode = MODE_NONE;
@ -641,12 +666,26 @@ void CChat::OnRender()
if(Now > m_aLines[r].m_Time+16*time_freq() && !m_Show)
break;
char aName[64] = "";
if(g_Config.m_ClShowIDs && m_aLines[r].m_ClientID != -1 && m_aLines[r].m_aName[0] != '\0')
{
if (m_aLines[r].m_ClientID >= 10)
str_format(aName, sizeof(aName),"%d: ", m_aLines[r].m_ClientID);
else
str_format(aName, sizeof(aName),"%d: ", m_aLines[r].m_ClientID);
str_append(aName, m_aLines[r].m_aName,sizeof(aName));
}
else
{
str_copy(aName, m_aLines[r].m_aName, sizeof(aName));
}
// get the y offset (calculate it if we haven't done that yet)
if(m_aLines[r].m_YOffset[OffsetType] < 0.0f)
{
TextRender()->SetCursor(&Cursor, Begin, 0.0f, FontSize, 0);
Cursor.m_LineWidth = LineWidth;
TextRender()->TextEx(&Cursor, m_aLines[r].m_aName, -1);
TextRender()->TextEx(&Cursor, aName, -1);
TextRender()->TextEx(&Cursor, m_aLines[r].m_aText, -1);
m_aLines[r].m_YOffset[OffsetType] = Cursor.m_Y + Cursor.m_FontSize;
}
@ -685,7 +724,7 @@ void CChat::OnRender()
else
TextRender()->TextColor(0.8f, 0.8f, 0.8f, Blend);
TextRender()->TextEx(&Cursor, m_aLines[r].m_aName, -1);
TextRender()->TextEx(&Cursor, aName, -1);
// render line
if (m_aLines[r].m_ClientID == -1)

View file

@ -108,17 +108,13 @@ void CGameConsole::CInstance::OnInput(IInput::CEvent Event)
Begin++;
continue;
}
int max = i - Begin + 1;
if(max > (int)sizeof(Line))
max = sizeof(Line);
int max = min(i - Begin + 1, (int)sizeof(Line));
str_copy(Line, Text + Begin, max);
Begin = i+1;
ExecuteLine(Line);
}
}
int max = i - Begin + 1;
if(max > (int)sizeof(Line))
max = sizeof(Line);
int max = min(i - Begin + 1, (int)sizeof(Line));
str_copy(Line, Text + Begin, max);
Begin = i+1;
m_Input.Add(Line);

View file

@ -319,11 +319,10 @@ void CHud::RenderTextInfo()
str_format(Buf, sizeof(Buf), "%d", (int)m_AverageFPS);
TextRender()->Text(0, m_Width-10-TextRender()->TextWidth(0,12,Buf,-1), 5, 12, Buf, -1);
}
if(g_Config.m_ClShowping)
if(g_Config.m_ClShowpred)
{
char aBuf[64];
str_format(aBuf, sizeof(aBuf), "%d", clamp(m_pClient->m_Snap.m_pLocalInfo->m_Latency, 0, 1000));
str_format(aBuf, sizeof(aBuf), "%d", Client()->GetPredictionTime());
TextRender()->Text(0, m_Width-10-TextRender()->TextWidth(0,12,aBuf,-1), g_Config.m_ClShowfps ? 20 : 5, 12, aBuf, -1);
}
}

View file

@ -54,7 +54,7 @@ void CKillMessages::OnRender()
Graphics()->MapScreen(0, 0, Width*1.5f, Height*1.5f);
float StartX = Width*1.5f-10.0f;
float y = 30.0f + 100.0f * (g_Config.m_ClShowfps + g_Config.m_ClShowping);
float y = 30.0f + 100.0f * (g_Config.m_ClShowfps + g_Config.m_ClShowpred);
for(int i = 1; i <= MAX_KILLMSGS; i++)
{

View file

@ -94,7 +94,8 @@ int CMapImages::GetEntities()
if(m_EntitiesTextures == -1 || str_comp(m_aEntitiesGameType, Info.m_aGameType))
{
char file[64] = "vanilla";
// DDNet default to prevent delay in seeing entities
char file[64] = "ddnet";
if(IsDDNet(&Info))
str_copy(file, "ddnet", sizeof(file));
else if(IsDDRace(&Info))
@ -103,6 +104,8 @@ int CMapImages::GetEntities()
str_copy(file, "race", sizeof(file));
else if(IsFNG(&Info))
str_copy(file, "fng", sizeof(file));
else if(IsVanilla(&Info))
str_copy(file, "vanilla", sizeof(file));
char path[64];
str_format(path, sizeof(path), "editor/entities_clear/%s.png", file);

View file

@ -244,9 +244,9 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS
const char *Text = Input()->GetClipboardText();
if(Text)
{
int CharsLeft = StrSize - str_length(pStr);
int Offset = str_length(pStr);
for(int i = 0; i < str_length(Text) && i <= CharsLeft; i++)
int CharsLeft = StrSize - Offset - 1;
for(int i = 0; i < str_length(Text) && i < CharsLeft; i++)
{
if(Text[i] == '\n')
pStr[i + Offset] = ' ';
@ -1057,29 +1057,12 @@ int CMenus::Render()
pTitle = Localize("Disconnected");
pExtraText = Client()->ErrorString();
pButtonText = Localize("Ok");
if ((str_find_nocase(Client()->ErrorString(), "full")) || (str_find_nocase(Client()->ErrorString(), "reserved")))
if(Client()->m_ReconnectTime > 0)
{
if (g_Config.m_ClReconnectFull > 0)
{
if (_my_rtime == 0)
_my_rtime = time_get();
str_format(aBuf, sizeof(aBuf), Localize("\n\nReconnect in %d sec"), ((_my_rtime - time_get()) / time_freq() + g_Config.m_ClReconnectFull));
pTitle = Client()->ErrorString();
pExtraText = aBuf;
pButtonText = Localize("Abort");
}
}
else if (str_find_nocase(Client()->ErrorString(), "Timeout"))
{
if (g_Config.m_ClReconnectTimeout > 0)
{
if (_my_rtime == 0)
_my_rtime = time_get();
str_format(aBuf, sizeof(aBuf), Localize("\n\nReconnect in %d sec"), ((_my_rtime - time_get()) / time_freq() + g_Config.m_ClReconnectTimeout));
pTitle = Client()->ErrorString();
pExtraText = aBuf;
pButtonText = Localize("Abort");
}
str_format(aBuf, sizeof(aBuf), Localize("\n\nReconnect in %d sec"), ((Client()->m_ReconnectTime - time_get()) / time_freq() + g_Config.m_ClReconnectFull));
pTitle = Client()->ErrorString();
pExtraText = aBuf;
pButtonText = Localize("Abort");
}
ExtraAlign = 0;
}
@ -1614,29 +1597,16 @@ int CMenus::Render()
static int s_Button = 0;
if(DoButton_Menu(&s_Button, pButtonText, 0, &Part) || m_EscapePressed || m_EnterPressed)
{
if(m_Popup == POPUP_DISCONNECTED && Client()->m_ReconnectTime > 0)
Client()->m_ReconnectTime = 0;
m_Popup = POPUP_NONE;
}
}
if(m_Popup == POPUP_NONE)
UI()->SetActiveItem(0);
}
if (m_Popup == POPUP_DISCONNECTED)
{
if (str_find_nocase(Client()->ErrorString(), "full") || str_find_nocase(Client()->ErrorString(), "reserved"))
{
if (g_Config.m_ClReconnectFull > 0 && time_get() > _my_rtime + time_freq() * g_Config.m_ClReconnectFull)
Client()->Connect(g_Config.m_UiServerAddress);
}
else if (str_find_nocase(Client()->ErrorString(), "Timeout"))
{
if (g_Config.m_ClReconnectTimeout > 0 && time_get() > _my_rtime + time_freq() * g_Config.m_ClReconnectTimeout)
Client()->Connect(g_Config.m_UiServerAddress);
}
}
else if (_my_rtime != 0) {
_my_rtime = 0;
}
return 0;
}

View file

@ -129,6 +129,7 @@ class CMenus : public CComponent
bool m_NeedRestartGraphics;
bool m_NeedRestartSound;
bool m_NeedRestartUpdate;
bool m_NeedRestartDDNet;
bool m_NeedSendinfo;
bool m_NeedSendDummyinfo;
int m_SettingPlayerPage;
@ -185,13 +186,13 @@ class CMenus : public CComponent
{
return !str_comp(m_aFilename, "..") ? true : !str_comp(Other.m_aFilename, "..") ? false :
m_IsDir && !Other.m_IsDir ? true : !m_IsDir && Other.m_IsDir ? false :
str_comp_filenames(m_aFilename, Other.m_aFilename) < 0;
str_comp_nocase(m_aFilename, Other.m_aFilename) < 0;
}
else
{
return !str_comp(m_aFilename, "..") ? true : !str_comp(Other.m_aFilename, "..") ? false :
m_IsDir && !Other.m_IsDir ? true : !m_IsDir && Other.m_IsDir ? false :
str_comp_filenames(m_aFilename, Other.m_aFilename) > 0;
str_comp_nocase(m_aFilename, Other.m_aFilename) > 0;
}
}
}
@ -320,7 +321,6 @@ public:
};
// DDRace
int64 _my_rtime; // reconnect time
int DoButton_CheckBox_DontCare(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
sorted_array<CDemoItem> m_lDemos;
void DemolistPopulate();
@ -381,7 +381,7 @@ private:
void RenderGhost(CUIRect MainView);
// found in menus_settings.cpp
void RenderSettingsDDRace(CUIRect MainView);
void RenderSettingsDDNet(CUIRect MainView);
void RenderSettingsHUD(CUIRect MainView);
};
#endif

View file

@ -683,11 +683,11 @@ void CMenus::RenderServerbrowserFilters(CUIRect View)
int NumTypes = ServerBrowser()->NumDDNetTypes();
int PerLine = 3;
if(MaxTypes <= 12)
ServerFilter.HSplitTop(8.0f, 0, &ServerFilter);
ServerFilter.HSplitTop(4.0f, 0, &ServerFilter);
ServerFilter.HSplitBottom(4.0f, &ServerFilter, 0);
const float TypesWidth = 40.0f;
const float TypesHeight = MaxTypes > 12 ? 15.0f : 20.0f;
const float TypesHeight = ServerFilter.h / ceil(MaxTypes / (float)PerLine);
CUIRect TypesRect, Left, Right;
@ -1310,7 +1310,7 @@ void CMenus::RenderServerbrowser(CUIRect MainView)
char aBuf[64];
if(str_comp(Client()->LatestVersion(), "0") != 0)
{
str_format(aBuf, sizeof(aBuf), Localize("DDNet %s is out! Download it at ddnet.tw!"), Client()->LatestVersion());
str_format(aBuf, sizeof(aBuf), Localize("DDNet %s is out! Download it at DDNet.tw!"), Client()->LatestVersion());
TextRender()->TextColor(1.0f, 0.4f, 0.4f, 1.0f);
}
else

View file

@ -344,6 +344,10 @@ void CMenus::RenderSettingsPlayer(CUIRect MainView)
void CMenus::RenderSettingsTee(CUIRect MainView)
{
CUIRect Button, Label, Button2, Dummy, DummyLabel, SkinList, QuickSearch, QuickSearchClearButton;
bool CheckSettings = false;
static int s_ClVanillaSkinsOnly = g_Config.m_ClVanillaSkinsOnly;
static bool s_InitSkinlist = true;
MainView.HSplitTop(10.0f, 0, &MainView);
@ -396,7 +400,15 @@ void CMenus::RenderSettingsTee(CUIRect MainView)
if(DoButton_CheckBox(&g_Config.m_ClVanillaSkinsOnly, Localize("Vanilla Skins only"), g_Config.m_ClVanillaSkinsOnly, &DummyLabel))
{
g_Config.m_ClVanillaSkinsOnly ^= 1;
m_NeedRestartSkins = true;
CheckSettings = true;
}
if(CheckSettings)
{
if(s_ClVanillaSkinsOnly == g_Config.m_ClVanillaSkinsOnly)
m_NeedRestartSkins = false;
else
m_NeedRestartSkins = true;
}
Dummy.HSplitTop(20.0f, &DummyLabel, &Dummy);
@ -792,7 +804,7 @@ void CMenus::RenderSettingsControls(CUIRect MainView)
void CMenus::RenderSettingsGraphics(CUIRect MainView)
{
CUIRect Button;
CUIRect Button, Label;
char aBuf[128];
bool CheckSettings = false;
@ -806,6 +818,7 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
static int s_GfxFsaaSamples = g_Config.m_GfxFsaaSamples;
static int s_GfxTextureQuality = g_Config.m_GfxTextureQuality;
static int s_GfxTextureCompression = g_Config.m_GfxTextureCompression;
static int s_GfxHighdpi = g_Config.m_GfxHighdpi;
CUIRect ModeList;
MainView.VSplitLeft(300.0f, &MainView, &ModeList);
@ -925,6 +938,13 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
if(DoButton_CheckBox(&g_Config.m_GfxHighDetail, Localize("High Detail"), g_Config.m_GfxHighDetail, &Button))
g_Config.m_GfxHighDetail ^= 1;
MainView.HSplitTop(20.0f, &Button, &MainView);
if(DoButton_CheckBox(&g_Config.m_GfxHighdpi, Localize("High-DPI screen support (experimental)"), g_Config.m_GfxHighdpi, &Button))
{
g_Config.m_GfxHighdpi ^= 1;
CheckSettings = true;
}
// check if the new settings require a restart
if(CheckSettings)
{
@ -934,12 +954,20 @@ void CMenus::RenderSettingsGraphics(CUIRect MainView)
s_GfxVsync == g_Config.m_GfxVsync &&
s_GfxFsaaSamples == g_Config.m_GfxFsaaSamples &&
s_GfxTextureQuality == g_Config.m_GfxTextureQuality &&
s_GfxTextureCompression == g_Config.m_GfxTextureCompression)
s_GfxTextureCompression == g_Config.m_GfxTextureCompression &&
s_GfxHighdpi == g_Config.m_GfxHighdpi)
m_NeedRestartGraphics = false;
else
m_NeedRestartGraphics = true;
}
MainView.HSplitTop(20.0f, &Label, &MainView);
Label.VSplitLeft(130.0f, &Label, &Button);
str_format(aBuf, sizeof(aBuf), "%s: %i", Localize("Refresh Rate"), g_Config.m_GfxRefreshRate);
UI()->DoLabelScaled(&Label, aBuf, 14.0f, -1);
Button.HMargin(2.0f, &Button);
g_Config.m_GfxRefreshRate = static_cast<int>(DoScrollbarH(&g_Config.m_GfxRefreshRate, &Button, g_Config.m_GfxRefreshRate/1000.0f)*1000.0f+0.1f);
CUIRect Text;
MainView.HSplitTop(20.0f, 0, &MainView);
MainView.HSplitTop(20.0f, &Text, &MainView);
@ -1274,7 +1302,7 @@ void CMenus::RenderSettings(CUIRect MainView)
else if(s_SettingsPage == 7)
RenderSettingsSound(MainView);
else if(s_SettingsPage == 8)
RenderSettingsDDRace(MainView);
RenderSettingsDDNet(MainView);
if(m_NeedRestartUpdate)
{
@ -1282,7 +1310,7 @@ void CMenus::RenderSettings(CUIRect MainView)
UI()->DoLabelScaled(&RestartWarning, Localize("DDNet Client needs to be restarted to complete update!"), 14.0f, -1);
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
}
else if(m_NeedRestartSkins || m_NeedRestartGraphics || m_NeedRestartSound)
else if(m_NeedRestartSkins || m_NeedRestartGraphics || m_NeedRestartSound || m_NeedRestartDDNet)
UI()->DoLabelScaled(&RestartWarning, Localize("You must restart the game for all settings to take effect."), 14.0f, -1);
}
void CMenus::RenderSettingsHUD(CUIRect MainView)
@ -1727,10 +1755,13 @@ void CMenus::RenderSettingsHUD(CUIRect MainView)
g_Config.m_ClReconnectTimeout = 5;*/
}
void CMenus::RenderSettingsDDRace(CUIRect MainView)
void CMenus::RenderSettingsDDNet(CUIRect MainView)
{
CUIRect Button, Left, Right, LeftLeft, Demo, Gameplay, Miscellaneous, Label, Background;
bool CheckSettings = false;
static int s_InpMouseOld = g_Config.m_InpMouseOld;
MainView.HSplitTop(100.0f, &Demo , &MainView);
Demo.HSplitTop(30.0f, &Label, &Demo);
@ -1868,6 +1899,19 @@ void CMenus::RenderSettingsDDRace(CUIRect MainView)
}
Left.HSplitTop(20.0f, &Button, &Left);
if(DoButton_CheckBox(&g_Config.m_InpMouseOld, Localize("Old mouse mode"), g_Config.m_InpMouseOld, &Button))
{
g_Config.m_InpMouseOld ^= 1;
CheckSettings = true;
}
if(CheckSettings)
{
if(s_InpMouseOld == g_Config.m_InpMouseOld)
m_NeedRestartDDNet = false;
else
m_NeedRestartDDNet = true;
}
CUIRect aRects[2];
Left.HSplitTop(5.0f, &Button, &Left);

View file

@ -365,7 +365,7 @@ public:
void FindWeaker(bool IsWeaker[2][MAX_CLIENTS]);
bool AntiPingPlayers() { return g_Config.m_ClAntiPing && g_Config.m_ClAntiPingPlayers && !m_Snap.m_SpecInfo.m_Active && Client()->State() != IClient::STATE_DEMOPLAYBACK; }
bool AntiPingPlayers() { return g_Config.m_ClAntiPing && g_Config.m_ClAntiPingPlayers && !m_Snap.m_SpecInfo.m_Active && Client()->State() != IClient::STATE_DEMOPLAYBACK && (m_Tuning[g_Config.m_ClDummy].m_PlayerCollision || m_Tuning[g_Config.m_ClDummy].m_PlayerHooking); }
bool AntiPingGrenade() { return g_Config.m_ClAntiPing && g_Config.m_ClAntiPingGrenade && !m_Snap.m_SpecInfo.m_Active && Client()->State() != IClient::STATE_DEMOPLAYBACK; }
bool AntiPingWeapons() { return g_Config.m_ClAntiPing && g_Config.m_ClAntiPingWeapons && !m_Snap.m_SpecInfo.m_Active && Client()->State() != IClient::STATE_DEMOPLAYBACK; }

View file

@ -70,11 +70,11 @@ void CCollision::Init(class CLayers *pLayers)
}
if(m_pLayers->TuneLayer())
{
{
unsigned int Size = m_pLayers->Map()->GetUncompressedDataSize(m_pLayers->TuneLayer()->m_Tune);
if (Size >= m_Width*m_Height*sizeof(CTuneTile))
m_pTune = static_cast<CTuneTile *>(m_pLayers->Map()->GetData(m_pLayers->TuneLayer()->m_Tune));
}
}
if(m_pLayers->FrontLayer())
{

View file

@ -1196,7 +1196,7 @@ void CEditor::DoToolbar(CUIRect ToolBar)
if(DoButton_Ex(&s_SpeedupButton, "Speedup", (pS && pS->m_Speedup)?0:-1, &Button, 0, "Speedup", CUI::CORNER_ALL))
{
static int s_SpeedupPopupID = 0;
UiInvokePopupMenu(&s_SpeedupPopupID, 0, UI()->MouseX(), UI()->MouseY(), 120, 53, PopupSpeedup);
UiInvokePopupMenu(&s_SpeedupPopupID, 0, UI()->MouseX(), UI()->MouseY(), 120, 48, PopupSpeedup);
}
// do switch button
TB_Bottom.VSplitLeft(5.0f, &Button, &TB_Bottom);
@ -1214,7 +1214,7 @@ void CEditor::DoToolbar(CUIRect ToolBar)
if(DoButton_Ex(&s_TuneButton, "Tune", (pS && pS->m_Tune)?0:-1, &Button, 0, "Tune", CUI::CORNER_ALL))
{
static int s_TunePopupID = 0;
UiInvokePopupMenu(&s_TunePopupID, 0, UI()->MouseX(), UI()->MouseY(), 120, 90, PopupTune);
UiInvokePopupMenu(&s_TunePopupID, 0, UI()->MouseX(), UI()->MouseY(), 120, 23, PopupTune);
}
}
@ -3012,7 +3012,7 @@ void CEditor::RenderLayers(CUIRect ToolBox, CUIRect ToolBar, CUIRect View)
m_SelectedGroup = g;
static int s_LayerPopupID = 0;
if(Result == 2)
UiInvokePopupMenu(&s_LayerPopupID, 0, UI()->MouseX(), UI()->MouseY(), 120, 260, PopupLayer);
UiInvokePopupMenu(&s_LayerPopupID, 0, UI()->MouseX(), UI()->MouseY(), 120, 280, PopupLayer);
}
LayerCur += 14.0f;
@ -4393,7 +4393,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
ToolBar.VSplitLeft(15.0f, &Button, &ToolBar);
ToolBar.VSplitLeft(12.0f, &Button, &ToolBar);
static int s_SyncButton;
if(DoButton_Editor(&s_SyncButton, pEnvelope->m_Synchronized?"X":"", 0, &Button, 0, "Enable envelope synchronization between clients"))
if(DoButton_Editor(&s_SyncButton, pEnvelope->m_Synchronized?"X":"", 0, &Button, 0, "Synchronize envelope animation to game time (restarts when you touch the start line)"))
pEnvelope->m_Synchronized = !pEnvelope->m_Synchronized;
ToolBar.VSplitLeft(4.0f, &Button, &ToolBar);

View file

@ -61,7 +61,7 @@ public:
m_aName[0] = 0;
m_Bottom = 0;
m_Top = 0;
m_Synchronized = true;
m_Synchronized = false;
}
void Resort()
@ -831,7 +831,7 @@ public:
bool operator<(const CFilelistItem &Other) { return !str_comp(m_aFilename, "..") ? true : !str_comp(Other.m_aFilename, "..") ? false :
m_IsDir && !Other.m_IsDir ? true : !m_IsDir && Other.m_IsDir ? false :
str_comp_filenames(m_aFilename, Other.m_aFilename) < 0; }
str_comp_nocase(m_aFilename, Other.m_aFilename) < 0; }
};
sorted_array<CFilelistItem> m_FileList;
int m_FilesStartAt;

View file

@ -877,50 +877,6 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
if(pTilemapItem->m_Version >= 3)
IntsToStr(pTilemapItem->m_aName, sizeof(pTiles->m_aName)/sizeof(int), pTiles->m_aName);
if (Size >= pTiles->m_Width*pTiles->m_Height*sizeof(CTile))
{
mem_copy(pTiles->m_pTiles, pData, pTiles->m_Width*pTiles->m_Height*sizeof(CTile));
if(pTiles->m_Game && pTilemapItem->m_Version == MakeVersion(1, *pTilemapItem))
{
for(int i = 0; i < pTiles->m_Width*pTiles->m_Height; i++)
{
if(pTiles->m_pTiles[i].m_Index)
pTiles->m_pTiles[i].m_Index += ENTITY_OFFSET;
}
}
// Convert race stoppers to ddrace stoppers
/*if(pTiles->m_Game)
{
for(int i = 0; i < pTiles->m_Width*pTiles->m_Height; i++)
{
if(pTiles->m_pTiles[i].m_Index == 29)
{
pTiles->m_pTiles[i].m_Index = 60;
pTiles->m_pTiles[i].m_Flags = TILEFLAG_HFLIP|TILEFLAG_VFLIP|TILEFLAG_ROTATE;
}
else if(pTiles->m_pTiles[i].m_Index == 30)
{
pTiles->m_pTiles[i].m_Index = 60;
pTiles->m_pTiles[i].m_Flags = TILEFLAG_ROTATE;
}
else if(pTiles->m_pTiles[i].m_Index == 31)
{
pTiles->m_pTiles[i].m_Index = 60;
pTiles->m_pTiles[i].m_Flags = TILEFLAG_HFLIP|TILEFLAG_VFLIP;
}
else if(pTiles->m_pTiles[i].m_Index == 32)
{
pTiles->m_pTiles[i].m_Index = 60;
pTiles->m_pTiles[i].m_Flags = 0;
}
}
}*/
}
DataFile.UnloadData(pTilemapItem->m_Data);
if(pTiles->m_Tele)
{
void *pTeleData = DataFile.GetData(pTilemapItem->m_Tele);
@ -1083,6 +1039,77 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
}
DataFile.UnloadData(pTilemapItem->m_Tune);
}
else // regular tile layer or game layer
{
if (Size >= pTiles->m_Width*pTiles->m_Height*sizeof(CTile))
{
mem_copy(pTiles->m_pTiles, pData, pTiles->m_Width*pTiles->m_Height*sizeof(CTile));
if(pTiles->m_Game && pTilemapItem->m_Version == MakeVersion(1, *pTilemapItem))
{
for(int i = 0; i < pTiles->m_Width*pTiles->m_Height; i++)
{
if(pTiles->m_pTiles[i].m_Index)
pTiles->m_pTiles[i].m_Index += ENTITY_OFFSET;
}
}
}
}
DataFile.UnloadData(pTilemapItem->m_Data);
// Remove unused tiles on game and front layers
/*if(pTiles->m_Game)
{
for(int i = 0; i < pTiles->m_Width*pTiles->m_Height; i++)
{
if(!IsValidGameTile(pTiles->m_pTiles[i].m_Index))
{
pTiles->m_pTiles[i].m_Index = 0;
pTiles->m_pTiles[i].m_Flags = 0;
}
}
}
if(pTiles->m_Front)
{
for(int i = 0; i < pTiles->m_Width*pTiles->m_Height; i++)
{
if(!IsValidFrontTile(pTiles->m_pTiles[i].m_Index))
{
pTiles->m_pTiles[i].m_Index = 0;
pTiles->m_pTiles[i].m_Flags = 0;
}
}
}*/
// Convert race stoppers to ddrace stoppers
/*if(pTiles->m_Game)
{
for(int i = 0; i < pTiles->m_Width*pTiles->m_Height; i++)
{
if(pTiles->m_pTiles[i].m_Index == 29)
{
pTiles->m_pTiles[i].m_Index = 60;
pTiles->m_pTiles[i].m_Flags = TILEFLAG_HFLIP|TILEFLAG_VFLIP|TILEFLAG_ROTATE;
}
else if(pTiles->m_pTiles[i].m_Index == 30)
{
pTiles->m_pTiles[i].m_Index = 60;
pTiles->m_pTiles[i].m_Flags = TILEFLAG_ROTATE;
}
else if(pTiles->m_pTiles[i].m_Index == 31)
{
pTiles->m_pTiles[i].m_Index = 60;
pTiles->m_pTiles[i].m_Flags = TILEFLAG_HFLIP|TILEFLAG_VFLIP;
}
else if(pTiles->m_pTiles[i].m_Index == 32)
{
pTiles->m_pTiles[i].m_Index = 60;
pTiles->m_pTiles[i].m_Flags = 0;
}
}
}*/
}
else if(pLayerItem->m_Type == LAYERTYPE_QUADS)
{

View file

@ -602,25 +602,25 @@ int CLayerTiles::RenderProperties(CUIRect *pToolBox)
switch(Result)
{
case 4:
Result = TILE_FREEZE;
Result = TILE_THROUGH_CUT;
break;
case 5:
Result = TILE_UNFREEZE;
Result = TILE_FREEZE;
break;
case 6:
Result = TILE_DFREEZE;
Result = TILE_UNFREEZE;
break;
case 7:
Result = TILE_DUNFREEZE;
Result = TILE_DFREEZE;
break;
case 8:
Result = TILE_TELECHECKIN;
Result = TILE_DUNFREEZE;
break;
case 9:
Result = TILE_TELECHECKINEVIL;
Result = TILE_TELECHECKIN;
break;
case 10:
Result = TILE_THROUGH_CUT;
Result = TILE_TELECHECKINEVIL;
default:
break;
}

View file

@ -1307,7 +1307,7 @@ static int s_GametileOpSelected = -1;
int CEditor::PopupSelectGametileOp(CEditor *pEditor, CUIRect View)
{
static const char *s_pButtonNames[] = { "Clear", "Collision", "Death", "Unhookable", "Freeze", "Unfreeze", "Deep Freeze", "Deep Unfreeze", "Check-Tele From", "Evil Check-Tele From", "Hookthrough" };
static const char *s_pButtonNames[] = { "Air", "Hookable", "Death", "Unhookable", "Hookthrough", "Freeze", "Unfreeze", "Deep Freeze", "Deep Unfreeze", "Blue Check-Tele", "Red Check-Tele" };
static unsigned s_NumButtons = sizeof(s_pButtonNames) / sizeof(char*);
CUIRect Button;
@ -1470,14 +1470,14 @@ int CEditor::PopupSwitch(CEditor *pEditor, CUIRect View)
enum
{
PROP_SwitchNumber=0,
PROP_SwitchDelay,
PROP_SwitchDelay=0,
PROP_SwitchNumber,
NUM_PROPS,
};
CProperty aProps[] = {
{"Number", pEditor->m_SwitchNum, PROPTYPE_INT_STEP, 0, 255},
{"Delay", pEditor->m_SwitchDelay, PROPTYPE_INT_STEP, 0, 255},
{"Number", pEditor->m_SwitchNum, PROPTYPE_INT_STEP, 0, 255},
{0},
};

View file

@ -18,9 +18,9 @@ void CGameContext::ConCredits(IConsole::IResult *pResult, void *pUserData)
CGameContext *pSelf = (CGameContext *) pUserData;
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "credit",
"DDRaceNetwork is maintained by deen.");
"DDNet is run by the DDNet staff (DDNet.tw/staff)");
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "credit",
"Many ideas from the great community,");
"Great maps and many ideas from the great community");
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "credit",
"Help and code by eeeee, HMH, east, CookieMichal, Learath2,");
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "credit",
@ -33,8 +33,6 @@ void CGameContext::ConCredits(IConsole::IResult *pResult, void *pUserData)
"Based on DDRace by the DDRace developers,");
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "credit",
"which is a mod of Teeworlds by the Teeworlds developers.");
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "credit",
"Check the changes on ddnet.tw");
}
void CGameContext::ConInfo(IConsole::IResult *pResult, void *pUserData)
@ -47,11 +45,11 @@ void CGameContext::ConInfo(IConsole::IResult *pResult, void *pUserData)
"Git revision hash: " GIT_SHORTREV_HASH);
#endif
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "info",
"Official site: ddnet.tw");
"Official site: DDNet.tw");
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "info",
"For more Info /cmdlist");
"For more info: /cmdlist");
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "info",
"Or visit ddnet.tw");
"Or visit DDNet.tw");
}
void CGameContext::ConHelp(IConsole::IResult *pResult, void *pUserData)
@ -396,7 +394,7 @@ void CGameContext::ConTeamTop5(IConsole::IResult *pResult, void *pUserData)
return;
}
if (pResult->NumArguments() > 0 && pResult->GetInteger(0) >= 0)
if (pResult->NumArguments() > 0 && pResult->GetInteger(0) > 0)
pSelf->Score()->ShowTeamTop5(pResult, pResult->m_ClientID, pUserData,
pResult->GetInteger(0));
else
@ -427,7 +425,7 @@ void CGameContext::ConTop5(IConsole::IResult *pResult, void *pUserData)
return;
}
if (pResult->NumArguments() > 0 && pResult->GetInteger(0) >= 0)
if (pResult->NumArguments() > 0 && pResult->GetInteger(0) > 0)
pSelf->Score()->ShowTop5(pResult, pResult->m_ClientID, pUserData,
pResult->GetInteger(0));
else

View file

@ -919,7 +919,7 @@ void CGameContext::OnClientEnter(int ClientID)
SendChat(-1, CGameContext::CHAT_ALL, aBuf);
SendChatTarget(ClientID, "DDraceNetwork Mod. Version: " GAME_VERSION);
SendChatTarget(ClientID, "please visit https://ddnet.tw or say /info for more info");
SendChatTarget(ClientID, "please visit DDNet.tw or say /info for more info");
if(g_Config.m_SvWelcome[0]!=0)
SendChatTarget(ClientID,g_Config.m_SvWelcome);
@ -930,7 +930,7 @@ void CGameContext::OnClientEnter(int ClientID)
if (g_Config.m_SvShowOthersDefault)
{
if (g_Config.m_SvShowOthers)
SendChatTarget(ClientID, "You can see other players. To disable this use the DDNet client and type /showothers .");
SendChatTarget(ClientID, "You can see other players. To disable this use DDNet client and type /showothers .");
m_apPlayers[ClientID]->m_ShowOthers = true;
}
@ -1166,7 +1166,7 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
return;
}
if(g_Config.m_SvJoinVoteDelay && Now < pPlayer->m_FirstVoteTick)
if(Now < pPlayer->m_FirstVoteTick)
{
char aBuf[64];
str_format(aBuf, sizeof(aBuf), "You must wait %d seconds before making your first vote", ((pPlayer->m_FirstVoteTick - Now) / TickSpeed) + 1);

View file

@ -422,7 +422,7 @@ void IGameController::ChangeMap(const char *pToMap)
{
/*str_copy(m_aMapWish, pToMap, sizeof(m_aMapWish));
EndRound();*/
str_copy(g_Config.m_SvMap, pToMap, sizeof(m_aMapWish));
str_copy(g_Config.m_SvMap, pToMap, sizeof(g_Config.m_SvMap));
}
/*void IGameController::CycleMap()

View file

@ -134,13 +134,9 @@ void CPlayer::Reset()
//
// Otherwise, block voting for 60 seconds after joining.
if(Now > GameServer()->m_NonEmptySince + 10 * TickSpeed)
{
m_FirstVoteTick = Now + 60 * TickSpeed;
}
m_FirstVoteTick = Now + g_Config.m_SvJoinVoteDelay * TickSpeed;
else
{
m_FirstVoteTick = Now;
}
}
void CPlayer::Tick()
@ -263,8 +259,6 @@ void CPlayer::PostTick()
m_aActLatency[i] = GameServer()->m_apPlayers[i]->m_Latency.m_Min;
}
}
else
m_aActLatency[m_ClientID] = GameServer()->m_apPlayers[m_ClientID]->m_Latency.m_Min;
// update view pos for spectators
if((m_Team == TEAM_SPECTATORS || m_Paused) && m_SpectatorID != SPEC_FREEVIEW && GameServer()->m_apPlayers[m_SpectatorID] && GameServer()->m_apPlayers[m_SpectatorID]->GetCharacter())

View file

@ -293,6 +293,12 @@ bool CSqlScore::MapVoteThread(CSqlServer* pSqlServer, const CSqlData *pGameData,
str_format(aBuf, sizeof(aBuf), "No map like \"%s\" found. Try adding a '%%' at the start if you don't know the first character. Example: /map %%castle for \"Out of Castle\"", pData->m_RequestedMap.Str());
pData->GameServer()->SendChatTarget(pData->m_ClientID, aBuf);
}
else if(Now < pPlayer->m_FirstVoteTick)
{
char aBuf[64];
str_format(aBuf, sizeof(aBuf), "You must wait %d seconds before making your first vote", ((pPlayer->m_FirstVoteTick - Now) / pData->Server()->TickSpeed()) + 1);
pData->GameServer()->SendChatTarget(pData->m_ClientID, aBuf);
}
else if(pPlayer->m_LastVoteCall && Timeleft > 0)
{
char aChatmsg[512] = {0};
@ -1086,16 +1092,16 @@ bool CSqlScore::ShowTimesThread(CSqlServer* pSqlServer, const CSqlData *pGameDat
if(pData->m_Search) // last 5 times of a player
{
if(pStamp == 0) // stamp is 00:00:00 cause it's an old entry from old times where there where no stamps yet
str_format(aBuf, sizeof(aBuf), "%d min %.2f sec, don't know how long ago", (int)(pTime/60), pTime-((int)pTime/60*60));
str_format(aBuf, sizeof(aBuf), "%02d:%05.02f, don't know how long ago", (int)(pTime/60), pTime-((int)pTime/60*60));
else
str_format(aBuf, sizeof(aBuf), "%s ago, %d min %.2f sec", pAgoString,(int)(pTime/60), pTime-((int)pTime/60*60));
str_format(aBuf, sizeof(aBuf), "%s ago, %02d:%05.02f", pAgoString, (int)(pTime/60), pTime-((int)pTime/60*60));
}
else // last 5 times of the server
{
if(pStamp == 0) // stamp is 00:00:00 cause it's an old entry from old times where there where no stamps yet
str_format(aBuf, sizeof(aBuf), "%s, %02d:%05.02f s, don't know when", pSqlServer->GetResults()->getString("Name").c_str(), (int)(pTime/60), pTime-((int)pTime/60*60));
str_format(aBuf, sizeof(aBuf), "%s, %02d:%05.02f, don't know when", pSqlServer->GetResults()->getString("Name").c_str(), (int)(pTime/60), pTime-((int)pTime/60*60));
else
str_format(aBuf, sizeof(aBuf), "%s, %s ago, %02d:%05.02f s", pSqlServer->GetResults()->getString("Name").c_str(), pAgoString, (int)(pTime/60), pTime-((int)pTime/60*60));
str_format(aBuf, sizeof(aBuf), "%s, %s ago, %02d:%05.02f", pSqlServer->GetResults()->getString("Name").c_str(), pAgoString, (int)(pTime/60), pTime-((int)pTime/60*60));
}
pData->GameServer()->SendChatTarget(pData->m_ClientID, aBuf);
}

View file

@ -36,7 +36,7 @@ MACRO_CONFIG_INT(ClShowKillMessages, cl_showkillmessages, 1, 0, 1, CFGFLAG_CLIEN
MACRO_CONFIG_INT(ClShowVotesAfterVoting, cl_show_votes_after_voting, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show votes window after voting")
MACRO_CONFIG_INT(ClShowLocalTimeAlways, cl_show_local_time_always, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Always show local time")
MACRO_CONFIG_INT(ClShowfps, cl_showfps, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show ingame FPS counter")
MACRO_CONFIG_INT(ClShowping, cl_showping, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show ingame ping counter")
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")
@ -149,7 +149,7 @@ MACRO_CONFIG_INT(SvVoteSpectateRejoindelay, sv_vote_spectate_rejoindelay, 3, 0,
MACRO_CONFIG_INT(SvVoteKick, sv_vote_kick, 1, 0, 1, CFGFLAG_SERVER, "Allow voting to kick players")
MACRO_CONFIG_INT(SvVoteKickMin, sv_vote_kick_min, 0, 0, MAX_CLIENTS, CFGFLAG_SERVER, "Minimum number of players required to start a kick vote")
MACRO_CONFIG_INT(SvVoteKickBantime, sv_vote_kick_bantime, 5, 0, 1440, CFGFLAG_SERVER, "The time in seconds to ban a player if kicked by vote. 0 makes it just use kick")
MACRO_CONFIG_INT(SvJoinVoteDelay, sv_join_vote_delay, 1, 0, 1, CFGFLAG_SERVER, "Add a delay before recently joined players can vote")
MACRO_CONFIG_INT(SvJoinVoteDelay, sv_join_vote_delay, 60, 0, 1000, CFGFLAG_SERVER, "Add a delay before recently joined players can vote (in seconds)")
MACRO_CONFIG_INT(SvOldTeleportWeapons, sv_old_teleport_weapons, 0, 0, 1, CFGFLAG_SERVER|CFGFLAG_GAME, "Teleporting of all weapons (deprecated, use special entities instead)");
MACRO_CONFIG_INT(SvOldTeleportHook, sv_old_teleport_hook, 0, 0, 1, CFGFLAG_SERVER|CFGFLAG_GAME, "Hook through teleporter (deprecated, use special entities instead)");
MACRO_CONFIG_INT(SvTeleportHoldHook, sv_teleport_hold_hook, 0, 0, 1, CFGFLAG_SERVER|CFGFLAG_GAME, "Hold hook when teleported");

View file

@ -3,8 +3,8 @@
#ifndef GAME_VERSION_H
#define GAME_VERSION_H
#include "generated/nethash.cpp"
#define GAME_VERSION "0.6.3, 10.0.1"
#define GAME_VERSION "0.6.3, 10.0.3"
#define GAME_NETVERSION "0.6 626fce9a778df4d4"
static const char GAME_RELEASE_VERSION[8] = "10.0.1";
static const char GAME_RELEASE_VERSION[8] = "10.0.3";
#define CLIENT_VERSIONNR 1000
#endif