Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion game/neo/scripts/kb_act.lst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
"blank" "=========================="
"blank" "#Valve_Communication_Title"
"blank" "=========================="
"+voicerecord" "#Valve_Use_Voice_Communication"
"+voicerecordglobalteam" "Team / Global Voice Chat"
"+voicerecordlocal" "Proximity Voice Chat"
"messagemode" "#Valve_Chat_Message"
"messagemode2" "#Valve_Team_Message"
"+attack3" "Ping Location"
Expand Down
24 changes: 24 additions & 0 deletions game/neo/scripts/mod_textures.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,29 @@
"width" "64"
"height" "64"
}
"voice_global"
{
"file" "vgui/hud/voice_global"
"x" "0"
"y" "0"
"width" "64"
"height" "64"
}
"voice_team"
{
"file" "vgui/hud/voice_team"
"x" "0"
"y" "0"
"width" "64"
"height" "64"
}
"voice_mute"
{
"file" "vgui/hud/voice_mute"
"x" "0"
"y" "0"
"width" "64"
"height" "64"
}
}
}
5 changes: 5 additions & 0 deletions src/game/client/c_baseplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#include "c_neo_player.h"
#include "weapon_tachi.h"
#include "ivieweffects.h"
#include "in_main.h"
#endif

// memdbgon must be the last include file in a .cpp file!!!
Expand Down Expand Up @@ -1373,6 +1374,10 @@ bool C_BasePlayer::CreateMove( float flInputSampleTime, CUserCmd *pCmd )
// Check to see if we're in vgui input mode...
DetermineVguiInputMode( pCmd );

#ifdef NEO
pCmd->voiceTransmitType = GetVoiceTransmitType();
#endif // NEO

return true;
}

Expand Down
63 changes: 63 additions & 0 deletions src/game/client/hud_voicestatus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
#include "c_playerresource.h"
#include "voice_common.h"
#include "vgui_avatarimage.h"
#ifdef NEO
#include "in_main.h"
#endif // NEO

ConVar *sv_alltalk = NULL;

Expand All @@ -35,6 +38,11 @@ class CHudVoiceSelfStatus : public CHudElement, public vgui::Panel

private:
CHudTexture *m_pVoiceIcon;
#ifdef NEO
CHudTexture *m_pTeamVoiceIcon;
CHudTexture *m_pGlobalVoiceIcon;
CHudTexture *m_pNoVoiceIcon;
#endif // NEO

Color m_clrIcon;
};
Expand Down Expand Up @@ -67,22 +75,73 @@ void CHudVoiceSelfStatus::ApplySchemeSettings(vgui::IScheme *pScheme)
void CHudVoiceSelfStatus::VidInit( void )
{
m_pVoiceIcon = gHUD.GetIcon( "voice_self" );
#ifdef NEO
m_pGlobalVoiceIcon = gHUD.GetIcon("voice_global");
m_pTeamVoiceIcon = gHUD.GetIcon("voice_team");
m_pNoVoiceIcon = gHUD.GetIcon("voice_mute");
#endif // NEO
}

bool CHudVoiceSelfStatus::ShouldDraw()
{
#ifdef NEO
return IsLocalPlayerHoldingAVoiceTransmitKey();// || GetClientVoiceMgr()->IsLocalPlayerSpeaking();
#else
return GetClientVoiceMgr()->IsLocalPlayerSpeaking();
#endif // NEO
}

void CHudVoiceSelfStatus::Paint()
{
#ifdef NEO
static CHudTexture* icon = m_pVoiceIcon;
static ConVarRef sv_neo_proximity_VoIP("sv_neo_proximity_VoIP");
switch (GetVoiceTransmitType())
{
case NeoVoiceTransmitType::NEO_VOICE_TRANSMIT_NONE:
if (!IsLocalPlayerHoldingAVoiceTransmitKey())
{
return;
}
icon = m_pNoVoiceIcon;
break;
case NeoVoiceTransmitType::NEO_VOICE_TRANSMIT_GLOBALTEAM:
if (sv_alltalk->GetBool())
{
icon = m_pGlobalVoiceIcon;
}
else
{
icon = m_pTeamVoiceIcon;
}
break;
case NeoVoiceTransmitType::NEO_VOICE_TRANSMIT_LOCAL:
if (!sv_neo_proximity_VoIP.GetBool())
{
return;
}
icon = m_pVoiceIcon;
break;
default:
Assert(false);
return;
}

if (!icon)
return;
#else
if( !m_pVoiceIcon )
return;
#endif // NEO

int x, y, w, h;
GetBounds( x, y, w, h );

#ifdef NEO
icon->DrawSelf( 0, 0, w, h, m_clrIcon );
#else
m_pVoiceIcon->DrawSelf( 0, 0, w, h, m_clrIcon );
#endif // NEO
}


Expand Down Expand Up @@ -208,7 +267,11 @@ void CHudVoiceStatus::OnThink( void )
for ( int iPlayerIndex=1; iPlayerIndex<=gpGlobals->maxClients; iPlayerIndex++ )
{
int activeSpeakerIndex = FindActiveSpeaker(iPlayerIndex);
#ifdef NEO
bool bSpeaking = GetClientVoiceMgr()->IsPlayerSpeakingNonProximity(iPlayerIndex);
#else
bool bSpeaking = GetClientVoiceMgr()->IsPlayerSpeaking(iPlayerIndex);
#endif // NEO

if (activeSpeakerIndex != m_SpeakingList.InvalidIndex() )
{
Expand Down
75 changes: 75 additions & 0 deletions src/game/client/in_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ static kbutton_t in_thermoptic;
static kbutton_t in_vision;
static kbutton_t in_spec_next;
static kbutton_t in_spec_prev;
static kbutton_t in_voicerecordlocal;
static kbutton_t in_voicerecordglobalteam;
#endif

/*
Expand Down Expand Up @@ -678,6 +680,71 @@ void IN_SpecNextDown(const CCommand &args) { KeyDown(&in_spec_next, args[1]); }
void IN_SpecPrevUp(const CCommand &args) { KeyUp(&in_spec_prev, args[1]); }
void IN_SpecPrevDown(const CCommand &args) { KeyDown(&in_spec_prev, args[1]); }

static NeoVoiceTransmitType voiceTransmitType = NeoVoiceTransmitType::NEO_VOICE_TRANSMIT_NONE;
NeoVoiceTransmitType GetVoiceTransmitType()
{
return voiceTransmitType;
}

static float nextLocalSpeakTime = 0.f;
static float nextGlobalTeamSpeakTime = 0.f;
static constexpr float DELAY_BETWEEN_SWITCHING_SPEAK_TYPE = 0.25f;
void IN_VoiceRecordLocalUp( const CCommand &args ) {
KeyUp(&in_voicerecordlocal, args[1]);
if (const bool isSpeaking = GetClientVoiceMgr() ? GetClientVoiceMgr()->IsLocalPlayerSpeaking() : true;
isSpeaking && GetVoiceTransmitType() == NeoVoiceTransmitType::NEO_VOICE_TRANSMIT_LOCAL)
{
nextGlobalTeamSpeakTime = Max(nextGlobalTeamSpeakTime, gpGlobals->curtime + DELAY_BETWEEN_SWITCHING_SPEAK_TYPE);
engine->ExecuteClientCmd("-voicerecord");
voiceTransmitType = NeoVoiceTransmitType::NEO_VOICE_TRANSMIT_NONE;
}
}
void IN_VoiceRecordLocalDown(const CCommand& args) {
KeyDown(&in_voicerecordlocal, args[1]);
if (gpGlobals->curtime < nextLocalSpeakTime)
{
return;
}

if (const bool isSpeaking = GetClientVoiceMgr() ? GetClientVoiceMgr()->IsLocalPlayerSpeaking() : true)
{
return;
}

voiceTransmitType = NeoVoiceTransmitType::NEO_VOICE_TRANSMIT_LOCAL;
engine->ExecuteClientCmd("+voicerecord");
}

void IN_VoiceRecordGlobalTeamUp( const CCommand &args ) {
KeyUp(&in_voicerecordglobalteam, args[1]);
if (const bool isSpeaking = GetClientVoiceMgr() ? GetClientVoiceMgr()->IsLocalPlayerSpeaking() : true;
isSpeaking && GetVoiceTransmitType() == NeoVoiceTransmitType::NEO_VOICE_TRANSMIT_GLOBALTEAM)
{
nextLocalSpeakTime = Max(nextLocalSpeakTime, gpGlobals->curtime + DELAY_BETWEEN_SWITCHING_SPEAK_TYPE);
engine->ExecuteClientCmd("-voicerecord");
voiceTransmitType = NeoVoiceTransmitType::NEO_VOICE_TRANSMIT_NONE;
}
}
void IN_VoiceRecordGlobalTeamDown(const CCommand& args) {
KeyDown(&in_voicerecordglobalteam, args[1]);
if (gpGlobals->curtime < nextGlobalTeamSpeakTime)
{
return;
}

if (const bool isSpeaking = GetClientVoiceMgr() ? GetClientVoiceMgr()->IsLocalPlayerSpeaking() : true)
{
return;
}

voiceTransmitType = NeoVoiceTransmitType::NEO_VOICE_TRANSMIT_GLOBALTEAM;
engine->ExecuteClientCmd("+voicerecord");
}

bool IsLocalPlayerHoldingAVoiceTransmitKey() {
return (in_voicerecordglobalteam.state & 1) || (in_voicerecordlocal.state & 1);
}

void IN_LeanLeftToggle(const CCommand& args)
{
if (::input->KeyState(&in_lean_left))
Expand Down Expand Up @@ -1946,6 +2013,12 @@ static ConCommand endspecnextplayer("-specnextplayer", IN_SpecNextUp);

static ConCommand startspecprevplayer("+specprevplayer", IN_SpecPrevDown);
static ConCommand endspecprevplayer("-specprevplayer", IN_SpecPrevUp);

static ConCommand startvoicerecordlocal("+voicerecordlocal", IN_VoiceRecordLocalDown);
static ConCommand endvoicerecordlocal("-voicerecordlocal", IN_VoiceRecordLocalUp);

static ConCommand startvoicerecordglobalteam("+voicerecordglobalteam", IN_VoiceRecordGlobalTeamDown);
static ConCommand endvoicerecordglobalteam("-voicerecordglobalteam", IN_VoiceRecordGlobalTeamUp);
#endif

/*
Expand Down Expand Up @@ -2018,6 +2091,8 @@ void CInput::LevelInit( void )
#ifdef NEO
nextMouseWheelUp = 0.f;
nextMouseWheelDown = 0.f;
nextLocalSpeakTime = 0.f;
nextGlobalTeamSpeakTime = 0.f;
#endif // NEO
}

5 changes: 5 additions & 0 deletions src/game/client/in_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@


#include "kbutton.h"
#ifdef NEO
#include "voice_common.h"
#endif // NEO


extern kbutton_t in_commandermousemove;
Expand All @@ -25,6 +28,8 @@ void IN_LeanReset();
void IN_SpeedReset();
void IN_LeanToggleReset();
void LiftAllToggleKeys();
NeoVoiceTransmitType GetVoiceTransmitType();
bool IsLocalPlayerHoldingAVoiceTransmitKey();
#endif // NEO

#endif // IN_MAIN_H
2 changes: 2 additions & 0 deletions src/game/shared/gamerules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,9 @@ ConVar skill( "skill", "1" );

void CGameRules::Think()
{
#ifndef NEO // NEO TODO (Adam) do this here once neogamerules::Think is fixed
GetVoiceGameMgr()->Update( gpGlobals->frametime );
#endif // NEO
SetSkillLevel( skill.GetInt() );

if ( log_verbose_enable.GetBool() )
Expand Down
4 changes: 4 additions & 0 deletions src/game/shared/hl2/hl2_usermessages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ void RegisterUserMessages( void )
usermessages->Register( "Rumble", 3 ); // Send a rumble to a controller
usermessages->Register( "Battery", 2 );
usermessages->Register( "Damage", 18 ); // BUG: floats are sent for coords, no variable bitfields in hud & fixed size Msg
#ifdef NEO
usermessages->Register( "VoiceMask", VOICE_MAX_PLAYERS_DW*4 * 3 + 1 );
#else
usermessages->Register( "VoiceMask", VOICE_MAX_PLAYERS_DW*4 * 2 + 1 );
#endif // NEO
usermessages->Register( "RequestState", 0 );
usermessages->Register( "CloseCaption", -1 ); // Show a caption (by string id number)(duration in 10th of a second)
usermessages->Register( "HintText", -1 ); // Displays hint text display
Expand Down
4 changes: 4 additions & 0 deletions src/game/shared/hl2mp/hl2mp_gamerules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
#include "hl2mp_player.h"
#include "weapon_hl2mpbasehlmpcombatweapon.h"
#include "team.h"
#ifndef NEO
#include "voice_gamemgr.h"
#endif // NEO
#include "hl2mp_gameinterface.h"
#include "hl2mp_cvars.h"

Expand Down Expand Up @@ -168,6 +170,7 @@ static const char *s_PreserveEnts[] =
END_SEND_TABLE()
#endif

#ifndef NEO
#ifndef CLIENT_DLL

class CVoiceGameMgrHelper : public IVoiceGameMgrHelper
Expand All @@ -182,6 +185,7 @@ static const char *s_PreserveEnts[] =
IVoiceGameMgrHelper *g_pVoiceGameMgrHelper = &g_VoiceGameMgrHelper;

#endif
#endif // NEO

// NOTE: the indices here must match TEAM_TERRORIST, TEAM_CT, TEAM_SPECTATOR, etc.
const char *sTeamNames[] =
Expand Down
Loading