mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-18 14:08:19 +00:00
Merge branch 'master' into pr_color_picker
This commit is contained in:
commit
638a82b9bb
|
@ -1184,7 +1184,6 @@ set(EXPECTED_DATA
|
|||
shader/tile.vert
|
||||
skins/Aoe4leg.png
|
||||
skins/PaladiN.png
|
||||
skins/Terrorist.png
|
||||
skins/antiantey.png
|
||||
skins/beast.png
|
||||
skins/blacktee.png
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 7.9 KiB |
Binary file not shown.
Before Width: | Height: | Size: 14 KiB |
|
@ -272,6 +272,11 @@ class CTextRender : public IEngineTextRender
|
|||
m_RenderFlags = Flags;
|
||||
}
|
||||
|
||||
virtual unsigned int GetRenderFlags()
|
||||
{
|
||||
return m_RenderFlags;
|
||||
}
|
||||
|
||||
void Grow(unsigned char *pIn, unsigned char *pOut, int w, int h, int OutlineCount)
|
||||
{
|
||||
for(int y = 0; y < h; y++)
|
||||
|
@ -856,6 +861,7 @@ public:
|
|||
|
||||
int ActualSize;
|
||||
int GotNewLine = 0;
|
||||
int GotNewLineLast = 0;
|
||||
float DrawX = 0.0f, DrawY = 0.0f;
|
||||
int LineCount = 0;
|
||||
float CursorX, CursorY;
|
||||
|
@ -965,10 +971,10 @@ public:
|
|||
Wlen = Cutter.m_CharCount;
|
||||
NewLine = 1;
|
||||
|
||||
if(WordGlyphs <= 3) // if we can't place 3 chars of the word on this line, take the next
|
||||
if(WordGlyphs <= 3 && GotNewLineLast == 0) // if we can't place 3 chars of the word on this line, take the next
|
||||
Wlen = 0;
|
||||
}
|
||||
else if(Compare.m_X - pCursor->m_StartX > pCursor->m_LineWidth)
|
||||
else if(Compare.m_X - pCursor->m_StartX > pCursor->m_LineWidth && GotNewLineLast == 0)
|
||||
{
|
||||
NewLine = 1;
|
||||
Wlen = 0;
|
||||
|
@ -1062,6 +1068,9 @@ public:
|
|||
|
||||
++CharacterCounter;
|
||||
}
|
||||
|
||||
if(DrawX > pCursor->m_LongestLineWidth)
|
||||
pCursor->m_LongestLineWidth = DrawX;
|
||||
}
|
||||
|
||||
if(NewLine)
|
||||
|
@ -1074,8 +1083,11 @@ public:
|
|||
DrawY = (int)(DrawY * FakeToScreenY) / FakeToScreenY;
|
||||
}
|
||||
GotNewLine = 1;
|
||||
GotNewLineLast = 1;
|
||||
++LineCount;
|
||||
}
|
||||
else
|
||||
GotNewLineLast = 0;
|
||||
}
|
||||
|
||||
if(pCursor->m_Flags & TEXTFLAG_RENDER)
|
||||
|
@ -1170,16 +1182,10 @@ public:
|
|||
TextContainer.m_StringInfo.m_QuadNum = TextContainer.m_StringInfo.m_CharacterQuads.size();
|
||||
if(Graphics()->IsTextBufferingEnabled())
|
||||
{
|
||||
size_t DataSize = TextContainer.m_StringInfo.m_CharacterQuads.size() * sizeof(STextCharQuad);
|
||||
void *pUploadData = &TextContainer.m_StringInfo.m_CharacterQuads[0];
|
||||
|
||||
TextContainer.m_StringInfo.m_QuadBufferObjectIndex = Graphics()->CreateBufferObject(DataSize, pUploadData);
|
||||
|
||||
for(size_t i = 0; i < m_DefaultTextContainerInfo.m_Attributes.size(); ++i)
|
||||
m_DefaultTextContainerInfo.m_Attributes[i].m_VertBufferBindingIndex = TextContainer.m_StringInfo.m_QuadBufferObjectIndex;
|
||||
|
||||
TextContainer.m_StringInfo.m_QuadBufferContainerIndex = Graphics()->CreateBufferContainer(&m_DefaultTextContainerInfo);
|
||||
Graphics()->IndicesNumRequiredNotify(TextContainer.m_StringInfo.m_QuadNum * 6);
|
||||
if((TextContainer.m_RenderFlags & TEXT_RENDER_FLAG_NO_AUTOMATIC_QUAD_UPLOAD) == 0)
|
||||
{
|
||||
UploadTextContainer(ContainerIndex);
|
||||
}
|
||||
}
|
||||
|
||||
TextContainer.m_LineCount = pCursor->m_LineCount;
|
||||
|
@ -1206,6 +1212,7 @@ public:
|
|||
|
||||
int ActualSize;
|
||||
int GotNewLine = 0;
|
||||
int GotNewLineLast = 0;
|
||||
float DrawX = 0.0f, DrawY = 0.0f;
|
||||
int LineCount = 0;
|
||||
float CursorX, CursorY;
|
||||
|
@ -1288,10 +1295,10 @@ public:
|
|||
Wlen = Cutter.m_CharCount;
|
||||
NewLine = 1;
|
||||
|
||||
if(WordGlyphs <= 3) // if we can't place 3 chars of the word on this line, take the next
|
||||
if(WordGlyphs <= 3 && GotNewLineLast == 0) // if we can't place 3 chars of the word on this line, take the next
|
||||
Wlen = 0;
|
||||
}
|
||||
else if(Compare.m_X - pCursor->m_StartX > pCursor->m_LineWidth)
|
||||
else if(Compare.m_X - pCursor->m_StartX > pCursor->m_LineWidth && GotNewLineLast == 0)
|
||||
{
|
||||
NewLine = 1;
|
||||
Wlen = 0;
|
||||
|
@ -1432,8 +1439,11 @@ public:
|
|||
DrawY = (int)(DrawY * FakeToScreenY) / FakeToScreenY;
|
||||
}
|
||||
GotNewLine = 1;
|
||||
GotNewLineLast = 1;
|
||||
++LineCount;
|
||||
}
|
||||
else
|
||||
GotNewLineLast = 0;
|
||||
}
|
||||
|
||||
if(TextContainer.m_StringInfo.m_CharacterQuads.size() != 0)
|
||||
|
@ -1445,7 +1455,7 @@ public:
|
|||
size_t DataSize = TextContainer.m_StringInfo.m_CharacterQuads.size() * sizeof(STextCharQuad);
|
||||
void *pUploadData = &TextContainer.m_StringInfo.m_CharacterQuads[0];
|
||||
|
||||
if(TextContainer.m_StringInfo.m_QuadBufferObjectIndex != -1)
|
||||
if(TextContainer.m_StringInfo.m_QuadBufferObjectIndex != -1 && (TextContainer.m_RenderFlags & TEXT_RENDER_FLAG_NO_AUTOMATIC_QUAD_UPLOAD) == 0)
|
||||
{
|
||||
Graphics()->RecreateBufferObject(TextContainer.m_StringInfo.m_QuadBufferObjectIndex, DataSize, pUploadData);
|
||||
Graphics()->IndicesNumRequiredNotify(TextContainer.m_StringInfo.m_QuadNum * 6);
|
||||
|
@ -1707,6 +1717,20 @@ public:
|
|||
FreeTextContainer(TextContainerIndex);
|
||||
}
|
||||
|
||||
virtual void UploadTextContainer(int TextContainerIndex)
|
||||
{
|
||||
STextContainer &TextContainer = GetTextContainer(TextContainerIndex);
|
||||
size_t DataSize = TextContainer.m_StringInfo.m_CharacterQuads.size() * sizeof(STextCharQuad);
|
||||
void *pUploadData = &TextContainer.m_StringInfo.m_CharacterQuads[0];
|
||||
TextContainer.m_StringInfo.m_QuadBufferObjectIndex = Graphics()->CreateBufferObject(DataSize, pUploadData);
|
||||
|
||||
for(size_t i = 0; i < m_DefaultTextContainerInfo.m_Attributes.size(); ++i)
|
||||
m_DefaultTextContainerInfo.m_Attributes[i].m_VertBufferBindingIndex = TextContainer.m_StringInfo.m_QuadBufferObjectIndex;
|
||||
|
||||
TextContainer.m_StringInfo.m_QuadBufferContainerIndex = Graphics()->CreateBufferContainer(&m_DefaultTextContainerInfo);
|
||||
Graphics()->IndicesNumRequiredNotify(TextContainer.m_StringInfo.m_QuadNum * 6);
|
||||
}
|
||||
|
||||
virtual void RenderTextContainer(int TextContainerIndex, STextRenderColor *pTextColor, STextRenderColor *pTextOutlineColor)
|
||||
{
|
||||
STextContainer &TextContainer = GetTextContainer(TextContainerIndex);
|
||||
|
|
|
@ -33,6 +33,8 @@ public:
|
|||
virtual const char *CollateNocase() const = 0;
|
||||
// syntax to insert a row into table or ignore if it already exists
|
||||
virtual const char *InsertIgnore() const = 0;
|
||||
// ORDER BY RANDOM()/RAND()
|
||||
virtual const char *Random() const = 0;
|
||||
|
||||
enum Status
|
||||
{
|
||||
|
|
|
@ -34,6 +34,7 @@ public:
|
|||
virtual const char *InsertTimestampAsUtc() const { return "?"; }
|
||||
virtual const char *CollateNocase() const { return "CONVERT(? USING utf8mb4) COLLATE utf8mb4_general_ci"; }
|
||||
virtual const char *InsertIgnore() const { return "INSERT IGNORE"; };
|
||||
virtual const char *Random() const { return "RAND()"; };
|
||||
|
||||
virtual Status Connect();
|
||||
virtual void Disconnect();
|
||||
|
|
|
@ -21,6 +21,7 @@ public:
|
|||
virtual const char *InsertTimestampAsUtc() const { return "DATETIME(?, 'utc')"; }
|
||||
virtual const char *CollateNocase() const { return "? COLLATE NOCASE"; }
|
||||
virtual const char *InsertIgnore() const { return "INSERT OR IGNORE"; };
|
||||
virtual const char *Random() const { return "RANDOM()"; };
|
||||
|
||||
virtual Status Connect();
|
||||
virtual void Disconnect();
|
||||
|
|
|
@ -25,6 +25,7 @@ enum ETextRenderFlags
|
|||
TEXT_RENDER_FLAG_NO_OVERSIZE = 1 << 5,
|
||||
TEXT_RENDER_FLAG_NO_FIRST_CHARACTER_X_BEARING = 1 << 6,
|
||||
TEXT_RENDER_FLAG_NO_LAST_CHARACTER_ADVANCE = 1 << 7,
|
||||
TEXT_RENDER_FLAG_NO_AUTOMATIC_QUAD_UPLOAD = 1 << 8,
|
||||
};
|
||||
|
||||
enum
|
||||
|
@ -96,6 +97,7 @@ public:
|
|||
virtual void SetCurFont(CFont *pFont) = 0;
|
||||
|
||||
virtual void SetRenderFlags(unsigned int Flags) = 0;
|
||||
virtual unsigned int GetRenderFlags() = 0;
|
||||
|
||||
ColorRGBA DefaultTextColor() { return ColorRGBA(1, 1, 1, 1); }
|
||||
ColorRGBA DefaultTextOutlineColor() { return ColorRGBA(0, 0, 0, 0.3f); }
|
||||
|
@ -110,6 +112,8 @@ public:
|
|||
virtual void SetTextContainerSelection(int TextContainerIndex, const char *pText, int CursorPos, int SelectionStart, int SelectionEnd) = 0;
|
||||
virtual void DeleteTextContainer(int TextContainerIndex) = 0;
|
||||
|
||||
virtual void UploadTextContainer(int TextContainerIndex) = 0;
|
||||
|
||||
virtual void RenderTextContainer(int TextContainerIndex, STextRenderColor *pTextColor, STextRenderColor *pTextOutlineColor) = 0;
|
||||
virtual void RenderTextContainer(int TextContainerIndex, STextRenderColor *pTextColor, STextRenderColor *pTextOutlineColor, float X, float Y) = 0;
|
||||
|
||||
|
|
|
@ -58,8 +58,7 @@ void CChat::RebuildChat()
|
|||
Graphics()->DeleteQuadContainer(m_aLines[i].m_QuadContainerIndex);
|
||||
m_aLines[i].m_QuadContainerIndex = -1;
|
||||
// recalculate sizes
|
||||
m_aLines[i].m_YOffset[0] = -1.f;
|
||||
m_aLines[i].m_YOffset[1] = -1.f;
|
||||
m_aLines[i].m_YOffset = -1.f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,7 +84,7 @@ void CChat::Reset()
|
|||
m_aLines[i].m_TimesRepeated = 0;
|
||||
m_aLines[i].m_HasRenderTee = false;
|
||||
}
|
||||
m_PrevScoreBoardShowed = false;
|
||||
|
||||
m_PrevShowChat = false;
|
||||
|
||||
m_ReverseTAB = false;
|
||||
|
@ -702,8 +701,7 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine)
|
|||
Graphics()->DeleteQuadContainer(pCurrentLine->m_QuadContainerIndex);
|
||||
pCurrentLine->m_QuadContainerIndex = -1;
|
||||
pCurrentLine->m_Time = time();
|
||||
pCurrentLine->m_YOffset[0] = -1.f;
|
||||
pCurrentLine->m_YOffset[1] = -1.f;
|
||||
pCurrentLine->m_YOffset = -1.f;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -712,8 +710,7 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine)
|
|||
pCurrentLine = &m_aLines[m_CurrentLine];
|
||||
pCurrentLine->m_TimesRepeated = 0;
|
||||
pCurrentLine->m_Time = time();
|
||||
pCurrentLine->m_YOffset[0] = -1.0f;
|
||||
pCurrentLine->m_YOffset[1] = -1.0f;
|
||||
pCurrentLine->m_YOffset = -1.0f;
|
||||
pCurrentLine->m_ClientID = ClientID;
|
||||
pCurrentLine->m_Team = Team;
|
||||
pCurrentLine->m_NameColor = -2;
|
||||
|
@ -893,12 +890,9 @@ void CChat::OnPrepareLines()
|
|||
float y = 300.0f - 28.0f;
|
||||
float FontSize = FONT_SIZE;
|
||||
|
||||
bool ForceRecreate = m_pClient->m_pScoreboard->Active() != m_PrevScoreBoardShowed;
|
||||
bool ShowLargeArea = m_Show || g_Config.m_ClShowChat == 2;
|
||||
bool ForceRecreate = ShowLargeArea != m_PrevShowChat;
|
||||
|
||||
ForceRecreate |= ShowLargeArea != m_PrevShowChat;
|
||||
|
||||
m_PrevScoreBoardShowed = m_pClient->m_pScoreboard->Active();
|
||||
m_PrevShowChat = ShowLargeArea;
|
||||
|
||||
float RealMsgPaddingX = MESSAGE_PADDING_X;
|
||||
|
@ -915,13 +909,12 @@ void CChat::OnPrepareLines()
|
|||
RealMsgPaddingTee = 0;
|
||||
|
||||
int64 Now = time();
|
||||
float LineWidth = (m_pClient->m_pScoreboard->Active() ? 90.0f : 200.0f) - RealMsgPaddingX - RealMsgPaddingTee;
|
||||
float LineWidth = CHAT_WIDTH - RealMsgPaddingX - RealMsgPaddingTee;
|
||||
|
||||
float HeightLimit = m_pClient->m_pScoreboard->Active() ? 180.0f : m_PrevShowChat ? 50.0f : 200.0f;
|
||||
float HeightLimit = m_PrevShowChat ? CHAT_HEIGHT_MIN : CHAT_HEIGHT_FULL;
|
||||
float Begin = x;
|
||||
float TextBegin = Begin + RealMsgPaddingX / 2.0f;
|
||||
CTextCursor Cursor;
|
||||
int OffsetType = m_pClient->m_pScoreboard->Active() ? 1 : 0;
|
||||
|
||||
for(int i = 0; i < MAX_LINES; i++)
|
||||
{
|
||||
|
@ -967,33 +960,40 @@ void CChat::OnPrepareLines()
|
|||
}
|
||||
|
||||
// get the y offset (calculate it if we haven't done that yet)
|
||||
if(m_aLines[r].m_YOffset[OffsetType] < 0.0f)
|
||||
if(m_aLines[r].m_YOffset < 0.0f)
|
||||
{
|
||||
TextRender()->SetCursor(&Cursor, TextBegin, 0.0f, FontSize, 0);
|
||||
Cursor.m_LineWidth = LineWidth;
|
||||
|
||||
Cursor.m_X += RealMsgPaddingTee;
|
||||
|
||||
if(m_aLines[r].m_Friend && g_Config.m_ClMessageFriend)
|
||||
if(m_aLines[r].m_ClientID >= 0 && m_aLines[r].m_aName[0] != '\0')
|
||||
{
|
||||
TextRender()->TextEx(&Cursor, "♥ ", -1);
|
||||
Cursor.m_X += RealMsgPaddingTee;
|
||||
|
||||
if(m_aLines[r].m_Friend && g_Config.m_ClMessageFriend)
|
||||
{
|
||||
TextRender()->TextEx(&Cursor, "♥ ", -1);
|
||||
}
|
||||
}
|
||||
|
||||
TextRender()->TextEx(&Cursor, aName, -1);
|
||||
if(m_aLines[r].m_TimesRepeated > 0)
|
||||
TextRender()->TextEx(&Cursor, aCount, -1);
|
||||
|
||||
TextRender()->TextEx(&Cursor, ": ", -1);
|
||||
if(m_aLines[r].m_ClientID >= 0 && m_aLines[r].m_aName[0] != '\0')
|
||||
{
|
||||
TextRender()->TextEx(&Cursor, ": ", -1);
|
||||
}
|
||||
|
||||
CTextCursor AppendCursor = Cursor;
|
||||
AppendCursor.m_StartX = Cursor.m_X;
|
||||
AppendCursor.m_LineWidth -= (Cursor.m_LongestLineWidth - Cursor.m_StartX);
|
||||
|
||||
TextRender()->TextEx(&AppendCursor, m_aLines[r].m_aText, -1);
|
||||
|
||||
m_aLines[r].m_YOffset[OffsetType] = AppendCursor.m_Y + AppendCursor.m_FontSize + RealMsgPaddingY;
|
||||
m_aLines[r].m_YOffset = AppendCursor.m_Y + AppendCursor.m_FontSize + RealMsgPaddingY;
|
||||
}
|
||||
|
||||
y -= m_aLines[r].m_YOffset[OffsetType];
|
||||
y -= m_aLines[r].m_YOffset;
|
||||
|
||||
// cut off if msgs waste too much space
|
||||
if(y < HeightLimit)
|
||||
|
@ -1002,6 +1002,9 @@ void CChat::OnPrepareLines()
|
|||
// the position the text was created
|
||||
m_aLines[r].m_TextYOffset = y + RealMsgPaddingY / 2.f;
|
||||
|
||||
int CurRenderFlags = TextRender()->GetRenderFlags();
|
||||
TextRender()->SetRenderFlags(CurRenderFlags | ETextRenderFlags::TEXT_RENDER_FLAG_NO_AUTOMATIC_QUAD_UPLOAD);
|
||||
|
||||
// reset the cursor
|
||||
TextRender()->SetCursor(&Cursor, TextBegin, m_aLines[r].m_TextYOffset, FontSize, TEXTFLAG_RENDER);
|
||||
Cursor.m_LineWidth = LineWidth;
|
||||
|
@ -1091,6 +1094,7 @@ void CChat::OnPrepareLines()
|
|||
TextRender()->TextColor(Color);
|
||||
|
||||
CTextCursor AppendCursor = Cursor;
|
||||
AppendCursor.m_LineWidth -= (Cursor.m_LongestLineWidth - Cursor.m_StartX);
|
||||
AppendCursor.m_StartX = Cursor.m_X;
|
||||
|
||||
if(m_aLines[r].m_TextContainerIndex == -1)
|
||||
|
@ -1100,10 +1104,14 @@ void CChat::OnPrepareLines()
|
|||
|
||||
if(g_Config.m_ClChatBackground && (m_aLines[r].m_aText[0] != '\0' || m_aLines[r].m_aName[0] != '\0'))
|
||||
{
|
||||
float Height = m_aLines[r].m_YOffset[OffsetType];
|
||||
float Height = m_aLines[r].m_YOffset;
|
||||
Graphics()->SetColor(1, 1, 1, 1);
|
||||
m_aLines[r].m_QuadContainerIndex = RenderTools()->CreateRoundRectQuadContainer(Begin, y, AppendCursor.m_LongestLineWidth - Begin + RealMsgPaddingX, Height, RealMsgPaddingY, CUI::CORNER_ALL);
|
||||
m_aLines[r].m_QuadContainerIndex = RenderTools()->CreateRoundRectQuadContainer(Begin, y, (AppendCursor.m_LongestLineWidth - TextBegin) + RealMsgPaddingX * 1.5f, Height, MESSAGE_ROUNDING, CUI::CORNER_ALL);
|
||||
}
|
||||
|
||||
TextRender()->SetRenderFlags(CurRenderFlags);
|
||||
if(m_aLines[r].m_TextContainerIndex != -1)
|
||||
TextRender()->UploadTextContainer(m_aLines[r].m_TextContainerIndex);
|
||||
}
|
||||
|
||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
@ -1111,6 +1119,10 @@ void CChat::OnPrepareLines()
|
|||
|
||||
void CChat::OnRender()
|
||||
{
|
||||
// Do not render chat when scoreboard active
|
||||
if(m_pClient->m_pScoreboard->Active())
|
||||
return;
|
||||
|
||||
// send pending chat messages
|
||||
if(m_PendingChatCounter > 0 && m_LastChatSend + time_freq() < time())
|
||||
{
|
||||
|
@ -1207,8 +1219,7 @@ void CChat::OnRender()
|
|||
OnPrepareLines();
|
||||
|
||||
int64 Now = time();
|
||||
float HeightLimit = m_pClient->m_pScoreboard->Active() ? 180.0f : m_PrevShowChat ? 50.0f : 200.0f;
|
||||
int OffsetType = m_pClient->m_pScoreboard->Active() ? 1 : 0;
|
||||
float HeightLimit = m_PrevShowChat ? CHAT_HEIGHT_MIN : CHAT_HEIGHT_FULL;
|
||||
|
||||
float RealMsgPaddingX = MESSAGE_PADDING_X;
|
||||
float RealMsgPaddingY = MESSAGE_PADDING_Y;
|
||||
|
@ -1225,7 +1236,7 @@ void CChat::OnRender()
|
|||
if(Now > m_aLines[r].m_Time + 16 * time_freq() && !m_PrevShowChat)
|
||||
break;
|
||||
|
||||
y -= m_aLines[r].m_YOffset[OffsetType];
|
||||
y -= m_aLines[r].m_YOffset;
|
||||
|
||||
// cut off if msgs waste too much space
|
||||
if(y < HeightLimit)
|
||||
|
@ -1262,7 +1273,7 @@ void CChat::OnRender()
|
|||
float RowHeight = FONT_SIZE + RealMsgPaddingY;
|
||||
float OffsetTeeY = MESSAGE_TEE_SIZE / 2.0f;
|
||||
float FullHeightMinusTee = RowHeight - MESSAGE_TEE_SIZE;
|
||||
float TWSkinUnreliableOffset = 0.5f; // teeworlds skins were always a bit in the ground
|
||||
float TWSkinUnreliableOffset = 0.25f; // teeworlds skins were always a bit in the ground
|
||||
|
||||
CAnimState *pIdleState = CAnimState::GetIdle();
|
||||
RenderTools()->RenderTee(pIdleState, &RenderInfo, EMOTE_NORMAL, vec2(1, 0.1f), vec2(x + (RealMsgPaddingX + MESSAGE_TEE_SIZE) / 2.0f, y + OffsetTeeY + FullHeightMinusTee / 2.0f + TWSkinUnreliableOffset), Blend);
|
||||
|
|
|
@ -11,6 +11,10 @@ class CChat : public CComponent
|
|||
{
|
||||
CLineInput m_Input;
|
||||
|
||||
static constexpr float CHAT_WIDTH = 200.0f;
|
||||
static constexpr float CHAT_HEIGHT_FULL = 200.0f;
|
||||
static constexpr float CHAT_HEIGHT_MIN = 50.0f;
|
||||
|
||||
enum
|
||||
{
|
||||
MAX_LINES = 25
|
||||
|
@ -19,7 +23,7 @@ class CChat : public CComponent
|
|||
struct CLine
|
||||
{
|
||||
int64 m_Time;
|
||||
float m_YOffset[2];
|
||||
float m_YOffset;
|
||||
int m_ClientID;
|
||||
int m_Team;
|
||||
int m_NameColor;
|
||||
|
@ -43,7 +47,6 @@ class CChat : public CComponent
|
|||
int m_TimesRepeated;
|
||||
};
|
||||
|
||||
bool m_PrevScoreBoardShowed;
|
||||
bool m_PrevShowChat;
|
||||
|
||||
CLine m_aLines[MAX_LINES];
|
||||
|
@ -113,11 +116,12 @@ public:
|
|||
CChat();
|
||||
|
||||
static constexpr float MESSAGE_PADDING_X = 5.0f;
|
||||
static constexpr float MESSAGE_TEE_SIZE = 8.0f;
|
||||
static constexpr float MESSAGE_TEE_SIZE = 7.0f;
|
||||
static constexpr float MESSAGE_TEE_PADDING_RIGHT = 0.5f;
|
||||
static constexpr float FONT_SIZE = 6.0f;
|
||||
static constexpr float MESSAGE_PADDING_Y = 3.f;
|
||||
static_assert(FONT_SIZE + MESSAGE_PADDING_Y >= 8.0f, "Corners for background chat are too huge for this combination of font size and message padding.");
|
||||
static constexpr float MESSAGE_PADDING_Y = 1.0f;
|
||||
static constexpr float MESSAGE_ROUNDING = 3.0f;
|
||||
static_assert(FONT_SIZE + MESSAGE_PADDING_Y >= MESSAGE_ROUNDING * 2.0f, "Corners for background chat are too huge for this combination of font size and message padding.");
|
||||
|
||||
bool IsActive() const { return m_Mode != MODE_NONE; }
|
||||
void AddLine(int ClientID, int Team, const char *pLine);
|
||||
|
|
|
@ -530,7 +530,7 @@ bool CMenus::RenderServerControlServer(CUIRect MainView)
|
|||
TotalShown++;
|
||||
}
|
||||
|
||||
UiDoListboxStart(&s_VoteList, &List, 24.0f, "", "", TotalShown, 1, s_CurVoteOption, s_ScrollValue);
|
||||
UiDoListboxStart(&s_VoteList, &List, 19.0f, "", "", TotalShown, 1, s_CurVoteOption, s_ScrollValue);
|
||||
|
||||
int i = -1;
|
||||
for(CVoteOptionClient *pOption = m_pClient->m_pVoting->m_pFirst; pOption; pOption = pOption->m_pNext)
|
||||
|
@ -542,7 +542,7 @@ bool CMenus::RenderServerControlServer(CUIRect MainView)
|
|||
CListboxItem Item = UiDoListboxNextItem(pOption);
|
||||
|
||||
if(Item.m_Visible)
|
||||
UI()->DoLabelScaled(&Item.m_Rect, pOption->m_aDescription, 16.0f, -1);
|
||||
UI()->DoLabelScaled(&Item.m_Rect, pOption->m_aDescription, 13.0f, -1);
|
||||
|
||||
if(NumVoteOptions < Total)
|
||||
aIndices[NumVoteOptions] = i;
|
||||
|
@ -608,13 +608,15 @@ void CMenus::RenderServerControl(CUIRect MainView)
|
|||
static int s_ControlPage = 0;
|
||||
|
||||
// render background
|
||||
CUIRect Bottom, Extended, TabBar, Button;
|
||||
CUIRect Bottom, RconExtension, TabBar, Button;
|
||||
MainView.HSplitTop(20.0f, &Bottom, &MainView);
|
||||
RenderTools()->DrawUIRect(&Bottom, ms_ColorTabbarActive, 0, 10.0f);
|
||||
MainView.HSplitTop(20.0f, &TabBar, &MainView);
|
||||
RenderTools()->DrawUIRect(&MainView, ms_ColorTabbarActive, CUI::CORNER_B, 10.0f);
|
||||
MainView.Margin(10.0f, &MainView);
|
||||
MainView.HSplitBottom(90.0f, &MainView, &Extended);
|
||||
|
||||
if(Client()->RconAuthed())
|
||||
MainView.HSplitBottom(90.0f, &MainView, &RconExtension);
|
||||
|
||||
// tab bar
|
||||
{
|
||||
|
@ -723,13 +725,14 @@ void CMenus::RenderServerControl(CUIRect MainView)
|
|||
if(Client()->RconAuthed())
|
||||
{
|
||||
// background
|
||||
Extended.Margin(10.0f, &Extended);
|
||||
Extended.HSplitTop(20.0f, &Bottom, &Extended);
|
||||
Extended.HSplitTop(5.0f, 0, &Extended);
|
||||
RconExtension.Margin(10.0f, &RconExtension);
|
||||
RconExtension.HSplitTop(20.0f, &Bottom, &RconExtension);
|
||||
RconExtension.HSplitTop(5.0f, 0, &RconExtension);
|
||||
|
||||
// force vote
|
||||
Bottom.VSplitLeft(5.0f, 0, &Bottom);
|
||||
Bottom.VSplitLeft(120.0f, &Button, &Bottom);
|
||||
|
||||
static int s_ForceVoteButton = 0;
|
||||
if(DoButton_Menu(&s_ForceVoteButton, Localize("Force vote"), 0, &Button))
|
||||
{
|
||||
|
@ -766,7 +769,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
|
|||
m_pClient->m_pVoting->RemovevoteOption(m_CallvoteSelectedOption);
|
||||
|
||||
// add vote
|
||||
Extended.HSplitTop(20.0f, &Bottom, &Extended);
|
||||
RconExtension.HSplitTop(20.0f, &Bottom, &RconExtension);
|
||||
Bottom.VSplitLeft(5.0f, 0, &Bottom);
|
||||
Bottom.VSplitLeft(250.0f, &Button, &Bottom);
|
||||
UI()->DoLabelScaled(&Button, Localize("Vote description:"), 14.0f, -1);
|
||||
|
@ -776,7 +779,7 @@ void CMenus::RenderServerControl(CUIRect MainView)
|
|||
|
||||
static char s_aVoteDescription[64] = {0};
|
||||
static char s_aVoteCommand[512] = {0};
|
||||
Extended.HSplitTop(20.0f, &Bottom, &Extended);
|
||||
RconExtension.HSplitTop(20.0f, &Bottom, &RconExtension);
|
||||
Bottom.VSplitRight(10.0f, &Bottom, 0);
|
||||
Bottom.VSplitRight(120.0f, &Bottom, &Button);
|
||||
static int s_AddVoteButton = 0;
|
||||
|
|
|
@ -1144,8 +1144,8 @@ bool CScore::RandomMapThread(IDbConnection *pSqlServer, const ISqlData *pGameDat
|
|||
str_format(aBuf, sizeof(aBuf),
|
||||
"SELECT Map FROM %s_maps "
|
||||
"WHERE Server = ? AND Map != ? AND Stars = ? "
|
||||
"ORDER BY RAND() LIMIT 1;",
|
||||
pSqlServer->GetPrefix());
|
||||
"ORDER BY %s LIMIT 1;",
|
||||
pSqlServer->GetPrefix(), pSqlServer->Random());
|
||||
pSqlServer->PrepareStatement(aBuf);
|
||||
pSqlServer->BindInt(3, pData->m_Stars);
|
||||
}
|
||||
|
@ -1154,8 +1154,8 @@ bool CScore::RandomMapThread(IDbConnection *pSqlServer, const ISqlData *pGameDat
|
|||
str_format(aBuf, sizeof(aBuf),
|
||||
"SELECT Map FROM %s_maps "
|
||||
"WHERE Server = ? AND Map != ? "
|
||||
"ORDER BY RAND() LIMIT 1;",
|
||||
pSqlServer->GetPrefix());
|
||||
"ORDER BY %s LIMIT 1;",
|
||||
pSqlServer->GetPrefix(), pSqlServer->Random());
|
||||
pSqlServer->PrepareStatement(aBuf);
|
||||
}
|
||||
pSqlServer->BindString(1, pData->m_ServerType);
|
||||
|
@ -1202,9 +1202,9 @@ bool CScore::RandomUnfinishedMapThread(IDbConnection *pSqlServer, const ISqlData
|
|||
" SELECT Map "
|
||||
" FROM %s_race "
|
||||
" WHERE Name = ?"
|
||||
") ORDER BY RAND() "
|
||||
") ORDER BY %s "
|
||||
"LIMIT 1;",
|
||||
pSqlServer->GetPrefix(), pSqlServer->GetPrefix());
|
||||
pSqlServer->GetPrefix(), pSqlServer->GetPrefix(), pSqlServer->Random());
|
||||
pSqlServer->PrepareStatement(aBuf);
|
||||
pSqlServer->BindString(1, pData->m_ServerType);
|
||||
pSqlServer->BindString(2, pData->m_CurrentMap);
|
||||
|
@ -1220,9 +1220,9 @@ bool CScore::RandomUnfinishedMapThread(IDbConnection *pSqlServer, const ISqlData
|
|||
" SELECT Map "
|
||||
" FROM %s_race as race "
|
||||
" WHERE Name = ?"
|
||||
") ORDER BY RAND() "
|
||||
") ORDER BY %s "
|
||||
"LIMIT 1;",
|
||||
pSqlServer->GetPrefix(), pSqlServer->GetPrefix());
|
||||
pSqlServer->GetPrefix(), pSqlServer->GetPrefix(), pSqlServer->Random());
|
||||
pSqlServer->PrepareStatement(aBuf);
|
||||
pSqlServer->BindString(1, pData->m_ServerType);
|
||||
pSqlServer->BindString(2, pData->m_CurrentMap);
|
||||
|
|
Loading…
Reference in a new issue