Improve voice chat hud element when using alltalk (#935)

* Increase talk slots from 9 > 10
* Change voice HUD color regarding players' team
This commit is contained in:
NachosChipeados 2025-11-06 08:24:06 -04:00 committed by GitHub
parent d9e250be4a
commit 87e6d8116e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 171 additions and 2 deletions

View file

@ -164,4 +164,154 @@
pin_corner_to_sibling TOP_RIGHT
pin_to_sibling_corner TOP_LEFT
}
voiceMic5
{
ControlName ImagePanel
wide 36
tall 36
visible 0
image "ui/icon_mic_active"
scaleImage 1
zpos 900
pin_to_sibling voiceMic4
pin_corner_to_sibling TOP_RIGHT
pin_to_sibling_corner BOTTOM_RIGHT
}
voiceName5
{
ControlName Label
wide 450
tall 36
visible 0
font Default_21_ShadowGlow
textAlignment east
textinsetx 13
zpos 900
pin_to_sibling voiceMic5
pin_corner_to_sibling TOP_RIGHT
pin_to_sibling_corner TOP_LEFT
}
voiceMic6
{
ControlName ImagePanel
wide 36
tall 36
visible 0
image "ui/icon_mic_active"
scaleImage 1
zpos 900
pin_to_sibling voiceMic5
pin_corner_to_sibling TOP_RIGHT
pin_to_sibling_corner BOTTOM_RIGHT
}
voiceName6
{
ControlName Label
wide 450
tall 36
visible 0
font Default_21_ShadowGlow
textAlignment east
textinsetx 13
zpos 900
pin_to_sibling voiceMic6
pin_corner_to_sibling TOP_RIGHT
pin_to_sibling_corner TOP_LEFT
}
voiceMic7
{
ControlName ImagePanel
wide 36
tall 36
visible 0
image "ui/icon_mic_active"
scaleImage 1
zpos 900
pin_to_sibling voiceMic6
pin_corner_to_sibling TOP_RIGHT
pin_to_sibling_corner BOTTOM_RIGHT
}
voiceName7
{
ControlName Label
wide 450
tall 36
visible 0
font Default_21_ShadowGlow
textAlignment east
textinsetx 13
zpos 900
pin_to_sibling voiceMic7
pin_corner_to_sibling TOP_RIGHT
pin_to_sibling_corner TOP_LEFT
}
voiceMic8
{
ControlName ImagePanel
wide 36
tall 36
visible 0
image "ui/icon_mic_active"
scaleImage 1
zpos 900
pin_to_sibling voiceMic7
pin_corner_to_sibling TOP_RIGHT
pin_to_sibling_corner BOTTOM_RIGHT
}
voiceName8
{
ControlName Label
wide 450
tall 36
visible 0
font Default_21_ShadowGlow
textAlignment east
textinsetx 13
zpos 900
pin_to_sibling voiceMic8
pin_corner_to_sibling TOP_RIGHT
pin_to_sibling_corner TOP_LEFT
}
voiceMic9
{
ControlName ImagePanel
wide 36
tall 36
visible 0
image "ui/icon_mic_active"
scaleImage 1
zpos 900
pin_to_sibling voiceMic8
pin_corner_to_sibling TOP_RIGHT
pin_to_sibling_corner BOTTOM_RIGHT
}
voiceName9
{
ControlName Label
wide 450
tall 36
visible 0
font Default_21_ShadowGlow
textAlignment east
textinsetx 13
zpos 900
pin_to_sibling voiceMic9
pin_corner_to_sibling TOP_RIGHT
pin_to_sibling_corner TOP_LEFT
}
}

View file

@ -5,8 +5,9 @@ global function InitVoiceHUD
global function UpdateVoiceHUD
const VOICEHUD_MAX = 5
const VOICEHUD_MAX = 10
const VOICEHUD_COLOR_FRIENDLY = [FRIENDLY_R, FRIENDLY_G, FRIENDLY_B, 255]
const VOICEHUD_COLOR_ENEMY = [ENEMY_R, ENEMY_G, ENEMY_B, 255]
function InitVoiceHUD( entity player )
{
@ -47,6 +48,12 @@ function UpdateVoiceHUD()
if ( !clGlobal.showingScoreboard && !clGlobal.isMenuOpen )
{
array<entity> teamPlayers = GetPlayerArrayOfTeam( localPlayer.GetTeam() )
bool allTalkEnabled = GetConVarBool( "sv_alltalk" )
if ( allTalkEnabled )
teamPlayers = GetPlayerArray()
if ( teamPlayers.len() > 1 )
{
foreach ( teamPlayer in teamPlayers )
@ -58,6 +65,18 @@ function UpdateVoiceHUD()
localPlayer.cv.voiceHUDArray[index].name.SetText( teamPlayer.GetPlayerNameWithClanTag() )
localPlayer.cv.voiceHUDArray[index].name.Show()
var color = [ 255, 255, 255, 255 ]
if ( allTalkEnabled )
{
if ( teamPlayer.GetTeam() == localPlayer.GetTeam() )
color = VOICEHUD_COLOR_FRIENDLY
else
color = VOICEHUD_COLOR_ENEMY
}
localPlayer.cv.voiceHUDArray[index].mic.SetColor( color )
localPlayer.cv.voiceHUDArray[index].name.SetColor( color )
index++
// Already showing max, can't do anything else