2010-05-29 07:25:38 +00:00
|
|
|
#ifndef GAME_CLIENT_COMPONENTS_CHAT_H
|
|
|
|
#define GAME_CLIENT_COMPONENTS_CHAT_H
|
|
|
|
#include <game/client/component.h>
|
|
|
|
#include <game/client/lineinput.h>
|
|
|
|
|
2010-08-25 14:15:59 +00:00
|
|
|
class CChat : public CComponent
|
|
|
|
{
|
|
|
|
CLineInput m_Input;
|
|
|
|
|
2010-09-27 19:41:41 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
MAX_LINES = 25,
|
|
|
|
};
|
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
struct CLine
|
|
|
|
{
|
|
|
|
int64 m_Time;
|
2010-10-15 17:26:20 +00:00
|
|
|
float m_YOffset[2];
|
2010-05-29 07:25:38 +00:00
|
|
|
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;
|
2010-05-30 12:01:11 +00:00
|
|
|
bool m_Show;
|
2010-10-11 00:29:30 +00:00
|
|
|
bool m_InputUpdate;
|
|
|
|
int m_ChatStringOffset;
|
2010-10-11 10:31:45 +00:00
|
|
|
int m_OldChatStringLength;
|
2010-05-29 07:25:38 +00:00
|
|
|
|
2010-08-25 20:30:21 +00:00
|
|
|
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);
|
2010-05-29 07:25:38 +00:00
|
|
|
|
|
|
|
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();
|
2010-09-12 10:43:03 +00:00
|
|
|
virtual void OnRelease();
|
2010-05-29 07:25:38 +00:00
|
|
|
virtual void OnMessage(int MsgType, void *pRawMsg);
|
|
|
|
virtual bool OnInput(IInput::CEvent Event);
|
|
|
|
};
|
|
|
|
#endif
|