Skip to content

Commit

Permalink
ux: open chat bubble when chatting in term-ux (Closed #167)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChillerDragon committed Dec 18, 2024
1 parent 45ce789 commit 8f048ca
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/game/client/components/chillerbot/terminalui/terminalui.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// ChillerDragon 2020 - chillerbot

#include <engine/client/serverbrowser.h>
#include <engine/shared/config.h>
#include <game/client/components/controls.h>
#include <game/client/gameclient.h>
#include <game/generated/protocol.h>

#include <base/ccurses.h>
#include <base/chillerbot/curses_colors.h>
Expand Down Expand Up @@ -376,6 +378,19 @@ void CTerminalUI::OnMessage(int MsgType, void *pRawMsg)
}
}

bool CTerminalUI::IsChatting()
{
if(InputMode() == INPUT_CHAT)
return true;
if(InputMode() == INPUT_CHAT_TEAM)
return true;
if(InputMode() == INPUT_SEARCH_CHAT)
return true;
if(InputMode() == INPUT_SEARCH_CHAT_TEAM)
return true;
return false;
}

void CTerminalUI::OnRender()
{
m_SendData[0] = false;
Expand All @@ -393,6 +408,14 @@ void CTerminalUI::OnRender()
if(cl_InterruptSignaled)
Console()->ExecuteLine("quit");

if(IsChatting())
{
m_aInputData[g_Config.m_ClDummy].m_PlayerFlags |= PLAYERFLAG_CHATTING;
// TODO: add a chillerbot hook into controls SendChat and set it from there
// otherwise we spam input network packets way too hard
m_SendData[g_Config.m_ClDummy] = true;
}

if(!m_pClient->m_Snap.m_pLocalCharacter)
return;
float X = m_pClient->m_Snap.m_pLocalCharacter->m_X;
Expand Down
4 changes: 4 additions & 0 deletions src/game/client/components/chillerbot/terminalui/terminalui.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ class CTerminalUI : public CComponent
}
};

// returns true if the curses chat input is open
// either public chat or team chat
bool IsChatting();

/*
m_LockKeyUntilRelease
Expand Down

0 comments on commit 8f048ca

Please sign in to comment.