2021-09-19 07:13:46 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace Components
|
|
|
|
{
|
|
|
|
class Chat : public Component
|
|
|
|
{
|
2021-09-19 09:49:12 -04:00
|
|
|
static constexpr auto FONT_ICON_CHAT_WIDTH_CALCULATION_MULTIPLIER = 2.0f;
|
2021-09-19 07:13:46 -04:00
|
|
|
public:
|
|
|
|
Chat();
|
|
|
|
|
|
|
|
private:
|
2021-09-19 09:49:12 -04:00
|
|
|
static Dvar::Var cg_chatWidth;
|
2022-05-31 11:57:44 -04:00
|
|
|
static Dvar::Var sv_disableChat;
|
|
|
|
|
|
|
|
// Game dvars
|
|
|
|
static Game::dvar_t** cg_chatHeight;
|
2021-09-19 09:49:12 -04:00
|
|
|
static Game::dvar_t** cg_chatTime;
|
|
|
|
|
2021-09-19 07:13:46 -04:00
|
|
|
static bool SendChat;
|
|
|
|
|
2022-01-10 13:42:58 -05:00
|
|
|
static std::mutex AccessMutex;
|
2022-01-01 08:08:02 -05:00
|
|
|
static std::unordered_set<std::uint64_t> MuteList;
|
|
|
|
|
2022-06-14 14:43:19 -04:00
|
|
|
static bool CanAddCallback; // ClientCommand & GSC thread are the same
|
|
|
|
static std::vector<Scripting::Function> SayCallbacks;
|
|
|
|
|
|
|
|
static const char* EvaluateSay(char* text, Game::gentity_t* player, int mode);
|
2021-09-19 07:13:46 -04:00
|
|
|
|
|
|
|
static void PreSayStub();
|
|
|
|
static void PostSayStub();
|
2021-09-19 09:49:12 -04:00
|
|
|
|
|
|
|
static void CheckChatLineEnd(const char*& inputBuffer, char*& lineBuffer, float& len, int chatHeight, float chatWidth, char*& lastSpacePos, char*& lastFontIconPos, int lastColor);
|
|
|
|
static void CG_AddToTeamChat(const char* text);
|
|
|
|
static void CG_AddToTeamChat_Stub();
|
2022-01-01 08:08:02 -05:00
|
|
|
|
|
|
|
static void MuteClient(const Game::client_t* client);
|
|
|
|
static void UnmuteClient(const Game::client_t* client);
|
2022-01-10 13:42:58 -05:00
|
|
|
static void UnmuteInternal(const std::uint64_t id, bool everyone = false);
|
2022-01-01 08:08:02 -05:00
|
|
|
static void AddChatCommands();
|
2022-06-14 14:43:19 -04:00
|
|
|
|
|
|
|
static int GetCallbackReturn();
|
|
|
|
static int ChatCallback(Game::gentity_s* self, const char* codePos, const char* message, int mode);
|
|
|
|
static void AddScriptFunctions();
|
2021-09-19 07:13:46 -04:00
|
|
|
};
|
|
|
|
}
|