mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-13 11:38:19 +00:00
ddf2883cb2
Conflicts: src/engine/client/client.cpp src/engine/server/server.cpp src/engine/shared/console.cpp src/game/server/gamecontext.cpp
68 lines
1.4 KiB
C++
68 lines
1.4 KiB
C++
#ifndef GAME_CLIENT_COMPONENTS_CHAT_H
|
|
#define GAME_CLIENT_COMPONENTS_CHAT_H
|
|
#include <game/client/component.h>
|
|
#include <game/client/lineinput.h>
|
|
|
|
class CChat : public CComponent
|
|
{
|
|
CLineInput m_Input;
|
|
|
|
enum
|
|
{
|
|
MAX_LINES = 25,
|
|
};
|
|
|
|
struct CLine
|
|
{
|
|
int64 m_Time;
|
|
float m_YOffset[2];
|
|
int m_ClientId;
|
|
int m_Team;
|
|
int m_NameColor;
|
|
char m_aName[64];
|
|
char m_aText[512];
|
|
};
|
|
|
|
CLine m_aLines[MAX_LINES];
|
|
int m_CurrentLine;
|
|
|
|
// chat
|
|
enum
|
|
{
|
|
MODE_NONE=0,
|
|
MODE_ALL,
|
|
MODE_TEAM,
|
|
};
|
|
|
|
int m_Mode;
|
|
bool m_Show;
|
|
bool m_InputUpdate;
|
|
int m_ChatStringOffset;
|
|
int m_OldChatStringLength;
|
|
|
|
static void ConSay(IConsole::IResult *pResult, void *pUserData, int ClientID);
|
|
static void ConSayTeam(IConsole::IResult *pResult, void *pUserData, int ClientID);
|
|
static void ConChat(IConsole::IResult *pResult, void *pUserData, int ClientID);
|
|
static void ConShowChat(IConsole::IResult *pResult, void *pUserData, int ClientID);
|
|
|
|
public:
|
|
CChat();
|
|
|
|
bool IsActive() const { return m_Mode != MODE_NONE; }
|
|
|
|
void AddLine(int ClientId, int Team, const char *pLine);
|
|
|
|
void EnableMode(int Team);
|
|
|
|
void Say(int Team, const char *pLine);
|
|
|
|
virtual void OnReset();
|
|
virtual void OnConsoleInit();
|
|
virtual void OnStateChange(int NewState, int OldState);
|
|
virtual void OnRender();
|
|
virtual void OnRelease();
|
|
virtual void OnMessage(int MsgType, void *pRawMsg);
|
|
virtual bool OnInput(IInput::CEvent Event);
|
|
};
|
|
#endif
|