mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge pull request #373 from H-M-H/eyewheel
Eyewheel (by Chairn and CytraL)
This commit is contained in:
commit
c38cba9bd0
|
@ -55,6 +55,7 @@ bool IsRace(const CServerInfo *pInfo);
|
||||||
bool IsDDRace(const CServerInfo *pInfo);
|
bool IsDDRace(const CServerInfo *pInfo);
|
||||||
bool IsDDNet(const CServerInfo *pInfo);
|
bool IsDDNet(const CServerInfo *pInfo);
|
||||||
bool Is64Player(const CServerInfo *pInfo);
|
bool Is64Player(const CServerInfo *pInfo);
|
||||||
|
bool IsPlus(const CServerInfo *pInfo);
|
||||||
|
|
||||||
class IServerBrowser : public IInterface
|
class IServerBrowser : public IInterface
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,3 +25,8 @@ bool Is64Player(const CServerInfo *pInfo)
|
||||||
|| str_find(pInfo->m_aName, "64")
|
|| str_find(pInfo->m_aName, "64")
|
||||||
|| IsDDNet(pInfo);
|
|| IsDDNet(pInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsPlus(const CServerInfo *pInfo)
|
||||||
|
{
|
||||||
|
return str_find(pInfo->m_aGameType, "+");
|
||||||
|
}
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
||||||
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
||||||
#include <engine/graphics.h>
|
#include <engine/graphics.h>
|
||||||
|
#include <engine/serverbrowser.h>
|
||||||
#include <engine/shared/config.h>
|
#include <engine/shared/config.h>
|
||||||
#include <game/generated/protocol.h>
|
#include <game/generated/protocol.h>
|
||||||
#include <game/generated/client_data.h>
|
#include <game/generated/client_data.h>
|
||||||
|
|
||||||
#include <game/gamecore.h> // get_angle
|
#include <game/gamecore.h> // get_angle
|
||||||
|
#include <game/client/animstate.h>
|
||||||
#include <game/client/ui.h>
|
#include <game/client/ui.h>
|
||||||
#include <game/client/render.h>
|
#include <game/client/render.h>
|
||||||
|
#include "chat.h"
|
||||||
#include "emoticon.h"
|
#include "emoticon.h"
|
||||||
|
|
||||||
CEmoticon::CEmoticon()
|
CEmoticon::CEmoticon()
|
||||||
|
@ -38,6 +41,7 @@ void CEmoticon::OnReset()
|
||||||
m_WasActive = false;
|
m_WasActive = false;
|
||||||
m_Active = false;
|
m_Active = false;
|
||||||
m_SelectedEmote = -1;
|
m_SelectedEmote = -1;
|
||||||
|
m_SelectedEyeEmote = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEmoticon::OnRelease()
|
void CEmoticon::OnRelease()
|
||||||
|
@ -45,10 +49,6 @@ void CEmoticon::OnRelease()
|
||||||
m_Active = false;
|
m_Active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEmoticon::OnMessage(int MsgType, void *pRawMsg)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CEmoticon::OnMouseMove(float x, float y)
|
bool CEmoticon::OnMouseMove(float x, float y)
|
||||||
{
|
{
|
||||||
if(!m_Active)
|
if(!m_Active)
|
||||||
|
@ -75,6 +75,8 @@ void CEmoticon::OnRender()
|
||||||
{
|
{
|
||||||
if(m_WasActive && m_SelectedEmote != -1)
|
if(m_WasActive && m_SelectedEmote != -1)
|
||||||
Emote(m_SelectedEmote);
|
Emote(m_SelectedEmote);
|
||||||
|
if(m_WasActive && m_SelectedEyeEmote != -1)
|
||||||
|
EyeEmote(m_SelectedEyeEmote);
|
||||||
m_WasActive = false;
|
m_WasActive = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -95,10 +97,13 @@ void CEmoticon::OnRender()
|
||||||
if (SelectedAngle < 0)
|
if (SelectedAngle < 0)
|
||||||
SelectedAngle += 2*pi;
|
SelectedAngle += 2*pi;
|
||||||
|
|
||||||
|
m_SelectedEmote = -1;
|
||||||
|
m_SelectedEyeEmote = -1;
|
||||||
if (length(m_SelectorMouse) > 110.0f)
|
if (length(m_SelectorMouse) > 110.0f)
|
||||||
m_SelectedEmote = (int)(SelectedAngle / (2*pi) * NUM_EMOTICONS);
|
m_SelectedEmote = (int)(SelectedAngle / (2*pi) * NUM_EMOTICONS);
|
||||||
else
|
else if(length(m_SelectorMouse) > 40.0f)
|
||||||
m_SelectedEmote = -1;
|
m_SelectedEyeEmote = (int)(SelectedAngle / (2*pi) * NUM_EMOTES);
|
||||||
|
|
||||||
|
|
||||||
CUIRect Screen = *UI()->Screen();
|
CUIRect Screen = *UI()->Screen();
|
||||||
|
|
||||||
|
@ -134,6 +139,48 @@ void CEmoticon::OnRender()
|
||||||
|
|
||||||
Graphics()->QuadsEnd();
|
Graphics()->QuadsEnd();
|
||||||
|
|
||||||
|
CServerInfo pServerInfo;
|
||||||
|
Client()->GetServerInfo(&pServerInfo);
|
||||||
|
if((IsDDRace(&pServerInfo) || IsDDNet(&pServerInfo) || IsPlus(&pServerInfo)) && g_Config.m_ClEyeWheel)
|
||||||
|
{
|
||||||
|
Graphics()->TextureSet(-1);
|
||||||
|
Graphics()->QuadsBegin();
|
||||||
|
Graphics()->SetColor(1.0,1.0,1.0,0.3f);
|
||||||
|
DrawCircle(Screen.w/2, Screen.h/2, 100.0f, 64);
|
||||||
|
Graphics()->QuadsEnd();
|
||||||
|
|
||||||
|
CTeeRenderInfo *pTeeInfo;
|
||||||
|
if(g_Config.m_ClDummy)
|
||||||
|
pTeeInfo = &m_pClient->m_aClients[m_pClient->Client()->m_LocalIDs[1]].m_RenderInfo;
|
||||||
|
else
|
||||||
|
pTeeInfo = &m_pClient->m_aClients[m_pClient->Client()->m_LocalIDs[0]].m_RenderInfo;
|
||||||
|
|
||||||
|
Graphics()->TextureSet(pTeeInfo->m_Texture);
|
||||||
|
|
||||||
|
for (int i = 0; i < NUM_EMOTES; i++)
|
||||||
|
{
|
||||||
|
float Angle = 2*pi*i/NUM_EMOTES;
|
||||||
|
if (Angle > pi)
|
||||||
|
Angle -= 2*pi;
|
||||||
|
|
||||||
|
bool Selected = m_SelectedEyeEmote == i;
|
||||||
|
|
||||||
|
pTeeInfo->m_Size = Selected ? 64.0f : 48.0f;
|
||||||
|
|
||||||
|
float NudgeX = 70.0f * cosf(Angle);
|
||||||
|
float NudgeY = 70.0f * sinf(Angle);
|
||||||
|
RenderTools()->RenderTee(CAnimState::GetIdle(), pTeeInfo, i, vec2(-1,0), vec2(Screen.w/2 + NudgeX, Screen.h/2 + NudgeY));
|
||||||
|
}
|
||||||
|
|
||||||
|
Graphics()->TextureSet(-1);
|
||||||
|
Graphics()->QuadsBegin();
|
||||||
|
Graphics()->SetColor(0,0,0,0.3f);
|
||||||
|
DrawCircle(Screen.w/2, Screen.h/2, 30.0f, 64);
|
||||||
|
Graphics()->QuadsEnd();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_SelectedEyeEmote = -1;
|
||||||
|
|
||||||
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_CURSOR].m_Id);
|
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_CURSOR].m_Id);
|
||||||
Graphics()->QuadsBegin();
|
Graphics()->QuadsBegin();
|
||||||
Graphics()->SetColor(1,1,1,1);
|
Graphics()->SetColor(1,1,1,1);
|
||||||
|
@ -155,3 +202,30 @@ void CEmoticon::Emote(int Emoticon)
|
||||||
Client()->SendMsgExY(&Msg, MSGFLAG_VITAL, false, !g_Config.m_ClDummy);
|
Client()->SendMsgExY(&Msg, MSGFLAG_VITAL, false, !g_Config.m_ClDummy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CEmoticon::EyeEmote(int Emote)
|
||||||
|
{
|
||||||
|
char aBuf[32];
|
||||||
|
switch(Emote)
|
||||||
|
{
|
||||||
|
case EMOTE_NORMAL:
|
||||||
|
str_format(aBuf, sizeof(aBuf), "/emote normal %d", g_Config.m_ClEyeDuration);
|
||||||
|
break;
|
||||||
|
case EMOTE_PAIN:
|
||||||
|
str_format(aBuf, sizeof(aBuf), "/emote pain %d", g_Config.m_ClEyeDuration);
|
||||||
|
break;
|
||||||
|
case EMOTE_HAPPY:
|
||||||
|
str_format(aBuf, sizeof(aBuf), "/emote happy %d", g_Config.m_ClEyeDuration);
|
||||||
|
break;
|
||||||
|
case EMOTE_SURPRISE:
|
||||||
|
str_format(aBuf, sizeof(aBuf), "/emote surprise %d", g_Config.m_ClEyeDuration);
|
||||||
|
break;
|
||||||
|
case EMOTE_ANGRY:
|
||||||
|
str_format(aBuf, sizeof(aBuf), "/emote angry %d", g_Config.m_ClEyeDuration);
|
||||||
|
break;
|
||||||
|
case EMOTE_BLINK:
|
||||||
|
str_format(aBuf, sizeof(aBuf), "/emote blink %d", g_Config.m_ClEyeDuration);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
GameClient()->m_pChat->Say(0, aBuf);
|
||||||
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ class CEmoticon : public CComponent
|
||||||
|
|
||||||
vec2 m_SelectorMouse;
|
vec2 m_SelectorMouse;
|
||||||
int m_SelectedEmote;
|
int m_SelectedEmote;
|
||||||
|
int m_SelectedEyeEmote;
|
||||||
|
|
||||||
static void ConKeyEmoticon(IConsole::IResult *pResult, void *pUserData);
|
static void ConKeyEmoticon(IConsole::IResult *pResult, void *pUserData);
|
||||||
static void ConEmote(IConsole::IResult *pResult, void *pUserData);
|
static void ConEmote(IConsole::IResult *pResult, void *pUserData);
|
||||||
|
@ -25,10 +26,10 @@ public:
|
||||||
virtual void OnConsoleInit();
|
virtual void OnConsoleInit();
|
||||||
virtual void OnRender();
|
virtual void OnRender();
|
||||||
virtual void OnRelease();
|
virtual void OnRelease();
|
||||||
virtual void OnMessage(int MsgType, void *pRawMsg);
|
|
||||||
virtual bool OnMouseMove(float x, float y);
|
virtual bool OnMouseMove(float x, float y);
|
||||||
|
|
||||||
void Emote(int Emoticon);
|
void Emote(int Emote);
|
||||||
|
void EyeEmote(int EyeEmote);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -35,6 +35,8 @@ MACRO_CONFIG_INT(ClShowChatFriends, cl_show_chat_friends, 0, 0, 1, CFGFLAG_CLIEN
|
||||||
MACRO_CONFIG_INT(ClShowKillMessages, cl_showkillmessages, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show kill messages")
|
MACRO_CONFIG_INT(ClShowKillMessages, cl_showkillmessages, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show kill messages")
|
||||||
MACRO_CONFIG_INT(ClShowVotesAfterVoting, cl_show_votes_after_voting, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show votes window after voting")
|
MACRO_CONFIG_INT(ClShowVotesAfterVoting, cl_show_votes_after_voting, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show votes window after voting")
|
||||||
MACRO_CONFIG_INT(ClShowfps, cl_showfps, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show ingame FPS counter")
|
MACRO_CONFIG_INT(ClShowfps, cl_showfps, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Show ingame FPS counter")
|
||||||
|
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")
|
||||||
|
|
||||||
MACRO_CONFIG_INT(ClAirjumpindicator, cl_airjumpindicator, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "")
|
MACRO_CONFIG_INT(ClAirjumpindicator, cl_airjumpindicator, 1, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "")
|
||||||
MACRO_CONFIG_INT(ClThreadsoundloading, cl_threadsoundloading, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Load sound files threaded")
|
MACRO_CONFIG_INT(ClThreadsoundloading, cl_threadsoundloading, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Load sound files threaded")
|
||||||
|
|
Loading…
Reference in a new issue