Ignore emoticon of spammy players (fixes #2387)

Add ignore emoticon button in player menu.
Someone needs to draw the graphic for that.
This commit is contained in:
def 2020-06-27 00:06:07 +02:00
parent a56fbbc340
commit 7608eb67d6
6 changed files with 28 additions and 5 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View file

@ -269,7 +269,7 @@ set_speedup_arrow = SpriteSet("speedup_arrow", image_speedup_arrow, 1, 1)
set_demobuttons = SpriteSet("demobuttons", image_demobuttons, 5, 1)
set_fileicons = SpriteSet("fileicons", image_fileicons, 8, 1)
set_guibuttons = SpriteSet("guibuttons", image_guibuttons, 12, 4)
set_guiicons = SpriteSet("guiicons", image_guiicons, 8, 2)
set_guiicons = SpriteSet("guiicons", image_guiicons, 12, 2)
set_demobuttons2 = SpriteSet("demobuttons2", image_demobuttons2, 4, 1)
set_audio_source = SpriteSet("audio_source", image_audio_source, 1, 1)
@ -423,6 +423,7 @@ container.sprites.Add(Sprite("guibutton_hover", set_guibuttons, 8,0,4,4))
container.sprites.Add(Sprite("guiicon_mute", set_guiicons, 0,0,4,2))
container.sprites.Add(Sprite("guiicon_friend", set_guiicons, 4,0,4,2))
container.sprites.Add(Sprite("guiicon_emoticon_mute", set_guiicons, 8,0,4,2))
container.sprites.Add(Sprite("audio_source", set_audio_source, 0,0,1,1))

View file

@ -183,6 +183,15 @@ void CMenus::RenderPlayers(CUIRect MainView)
Graphics()->QuadsDrawTL(&QuadItem, 1);
Graphics()->QuadsEnd();
ButtonBar.HMargin(1.0f, &ButtonBar);
ButtonBar.VSplitLeft(Width, &Button, &ButtonBar);
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GUIICONS].m_Id);
Graphics()->QuadsBegin();
RenderTools()->SelectSprite(SPRITE_GUIICON_EMOTICON_MUTE);
QuadItem = IGraphics::CQuadItem(Button.x, Button.y, Button.w, Button.h);
Graphics()->QuadsDrawTL(&QuadItem, 1);
Graphics()->QuadsEnd();
ButtonBar.VSplitLeft(20.0f, 0, &ButtonBar);
ButtonBar.VSplitLeft(Width, &Button, &ButtonBar);
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_GUIICONS].m_Id);
@ -214,7 +223,7 @@ void CMenus::RenderPlayers(CUIRect MainView)
UiDoListboxStart(&s_VoteList, &List, 24.0f, "", "", TotalPlayers, 1, -1, s_ScrollValue);
// options
static int s_aPlayerIDs[MAX_CLIENTS][2] = {{0}};
static int s_aPlayerIDs[MAX_CLIENTS][3] = {{0}};
for(int i = 0, Count = 0; i < MAX_CLIENTS; ++i)
{
@ -261,7 +270,7 @@ void CMenus::RenderPlayers(CUIRect MainView)
m_pClient->m_pCountryFlags->Render(m_pClient->m_aClients[Index].m_Country, &Color,
Button2.x, Button2.y + Button2.h/2.0f - 0.75*Button2.h/2.0f, 1.5f*Button2.h, 0.75f*Button2.h);
// ignore button
// ignore chat button
Item.m_Rect.HMargin(2.0f, &Item.m_Rect);
Item.m_Rect.VSplitLeft(Width, &Button, &Item.m_Rect);
Button.VSplitLeft((Width-Button.h)/4.0f, 0, &Button);
@ -272,12 +281,23 @@ void CMenus::RenderPlayers(CUIRect MainView)
if(DoButton_Toggle(&s_aPlayerIDs[Index][0], m_pClient->m_aClients[Index].m_ChatIgnore, &Button, true))
m_pClient->m_aClients[Index].m_ChatIgnore ^= 1;
// ignore emoticon button
Item.m_Rect.VSplitLeft(20.0f, &Button, &Item.m_Rect);
Item.m_Rect.VSplitLeft(Width, &Button, &Item.m_Rect);
Button.VSplitLeft((Width-Button.h)/4.0f, 0, &Button);
Button.VSplitLeft(Button.h, &Button, 0);
if(g_Config.m_ClShowChatFriends && !m_pClient->m_aClients[Index].m_Friend)
DoButton_Toggle(&s_aPlayerIDs[Index][1], 1, &Button, false);
else
if(DoButton_Toggle(&s_aPlayerIDs[Index][1], m_pClient->m_aClients[Index].m_EmoticonIgnore, &Button, true))
m_pClient->m_aClients[Index].m_EmoticonIgnore ^= 1;
// friend button
Item.m_Rect.VSplitLeft(20.0f, &Button, &Item.m_Rect);
Item.m_Rect.VSplitLeft(Width, &Button, &Item.m_Rect);
Button.VSplitLeft((Width-Button.h)/4.0f, 0, &Button);
Button.VSplitLeft(Button.h, &Button, 0);
if(DoButton_Toggle(&s_aPlayerIDs[Index][1], m_pClient->m_aClients[Index].m_Friend, &Button, true))
if(DoButton_Toggle(&s_aPlayerIDs[Index][2], m_pClient->m_aClients[Index].m_Friend, &Button, true))
{
if(m_pClient->m_aClients[Index].m_Friend)
m_pClient->Friends()->RemoveFriend(m_pClient->m_aClients[Index].m_aName, m_pClient->m_aClients[Index].m_aClan);

View file

@ -592,7 +592,7 @@ void CPlayers::RenderPlayer(
Graphics()->QuadsSetRotation(0);
}
if(g_Config.m_ClShowEmotes && m_pClient->m_aClients[ClientID].m_EmoticonStart != -1 && m_pClient->m_aClients[ClientID].m_EmoticonStart <= Client()->GameTick(g_Config.m_ClDummy) && m_pClient->m_aClients[ClientID].m_EmoticonStart + 2 * Client()->GameTickSpeed() > Client()->GameTick(g_Config.m_ClDummy))
if(g_Config.m_ClShowEmotes && !m_pClient->m_aClients[ClientID].m_EmoticonIgnore && m_pClient->m_aClients[ClientID].m_EmoticonStart != -1 && m_pClient->m_aClients[ClientID].m_EmoticonStart <= Client()->GameTick(g_Config.m_ClDummy) && m_pClient->m_aClients[ClientID].m_EmoticonStart + 2 * Client()->GameTickSpeed() > Client()->GameTick(g_Config.m_ClDummy))
{
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_EMOTICONS].m_Id);

View file

@ -1859,6 +1859,7 @@ void CGameClient::CClientData::Reset()
m_EmoticonStart = -1;
m_Active = false;
m_ChatIgnore = false;
m_EmoticonIgnore = false;
m_Friend = false;
m_Foe = false;
m_AuthLevel = AUTHED_NO;

View file

@ -266,6 +266,7 @@ public:
float m_Angle;
bool m_Active;
bool m_ChatIgnore;
bool m_EmoticonIgnore;
bool m_Friend;
bool m_Foe;