From 3bf9ba7e42344cd58dd8edafc46c21d73a2b7e15 Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Fri, 31 Jul 2026 17:14:16 +0100 Subject: [PATCH 1/6] init --- src/game/client/neo/c_neo_player.cpp | 67 ++---------------- src/game/client/neo/c_neo_player.h | 5 +- src/game/server/neo/neo_player.cpp | 69 ++----------------- src/game/server/neo/neo_player.h | 2 +- src/game/shared/neo/neo_player_shared.cpp | 84 ++++++++++++++++++++++- 5 files changed, 95 insertions(+), 132 deletions(-) diff --git a/src/game/client/neo/c_neo_player.cpp b/src/game/client/neo/c_neo_player.cpp index 0b6563fae..ea48ec77a 100644 --- a/src/game/client/neo/c_neo_player.cpp +++ b/src/game/client/neo/c_neo_player.cpp @@ -94,7 +94,7 @@ IMPLEMENT_CLIENTCLASS_DT(C_NEO_Player, DT_NEO_Player, CNEO_Player) RecvPropBool(RECVINFO(m_bCarryingGhost)), RecvPropTime(RECVINFO(m_flCamoAuxLastTime)), - RecvPropInt(RECVINFO(m_nVisionLastTick)), + RecvPropTime(RECVINFO(m_flVisionLastTime)), RecvPropTime(RECVINFO(m_flJumpLastTime)), RecvPropTime(RECVINFO(m_flNextPingTime)), @@ -123,7 +123,7 @@ BEGIN_PREDICTION_DATA(C_NEO_Player) DEFINE_PRED_FIELD(m_bInVision, FIELD_BOOLEAN, FTYPEDESC_INSENDTABLE), DEFINE_PRED_FIELD(m_bHasBeenAirborneForTooLongToSuperJump, FIELD_BOOLEAN, FTYPEDESC_INSENDTABLE), - DEFINE_PRED_FIELD(m_nVisionLastTick, FIELD_INTEGER, FTYPEDESC_INSENDTABLE), + DEFINE_PRED_FIELD_TOL(m_flVisionLastTime, FIELD_FLOAT, FTYPEDESC_INSENDTABLE, TD_MSECTOLERANCE), DEFINE_PRED_FIELD_TOL(m_flJumpLastTime, FIELD_FLOAT, FTYPEDESC_INSENDTABLE, TD_MSECTOLERANCE), DEFINE_PRED_FIELD_TOL(m_flNextPingTime, FIELD_FLOAT, FTYPEDESC_INSENDTABLE, TD_MSECTOLERANCE), END_PREDICTION_DATA() @@ -458,7 +458,7 @@ C_NEO_Player::C_NEO_Player() m_bInLean = NEO_LEAN_NONE; m_flCamoAuxLastTime = 0; - m_nVisionLastTick = 0; + m_flVisionLastTime = 0; m_flLastAirborneJumpOkTime = 0; m_flLastSuperJumpTime = 0; @@ -466,7 +466,6 @@ C_NEO_Player::C_NEO_Player() m_bFirstDeathTick = true; m_bPreviouslyReloading = false; m_bLastTickInThermOpticCamo = false; - m_bIsAllowedToToggleVision = false; m_bSpecRefreshedStates = false; m_flTocFactor = 0.15f; @@ -510,44 +509,6 @@ void C_NEO_Player::CheckThermOpticButtons() } } -void C_NEO_Player::CheckVisionButtons() -{ - if (!m_bIsAllowedToToggleVision) - { - return; - } - - if (m_afButtonPressed & IN_VISION) - { - if (IsAlive()) - { - m_bIsAllowedToToggleVision = false; - - m_bInVision = !m_bInVision; - - if (m_bInVision) - { - DevMsg("Playing sound at :%f\n", gpGlobals->curtime); - - C_RecipientFilter filter; - filter.AddRecipient(this); - filter.MakeReliable(); - filter.UsePredictionRules(); - - EmitSound_t params; - params.m_bEmitCloseCaption = false; - params.m_pOrigin = &GetAbsOrigin(); - params.m_nChannel = CHAN_ITEM; - params.m_nFlags |= SND_DO_NOT_OVERWRITE_EXISTING_ON_CHANNEL; - static int visionToggle = CBaseEntity::PrecacheScriptSound("NeoPlayer.VisionOn"); - params.m_hSoundScriptHandle = visionToggle; - - EmitSound(filter, entindex(), params); - } - } - } -} - void C_NEO_Player::CheckLeanButtons() { if (!IsAlive() || GetFlags() & FL_FROZEN) @@ -1595,7 +1556,7 @@ void C_NEO_Player::Spawn( void ) m_flCamoAuxLastTime = 0; m_bInVision = false; - m_nVisionLastTick = 0; + m_flVisionLastTime = 0; m_bInLean = NEO_LEAN_NONE; ClearLocalPlayerDmgReports(); @@ -1925,23 +1886,6 @@ void C_NEO_Player::SetCloakState(bool state) } } -void C_NEO_Player::PreDataUpdate(DataUpdateType_t updateType) -{ - if (updateType == DATA_UPDATE_DATATABLE_CHANGED) - { - if (gpGlobals->tickcount - m_nVisionLastTick < TIME_TO_TICKS(0.1f)) - { - return; - } - else - { - m_bIsAllowedToToggleVision = true; - } - } - - BaseClass::PreDataUpdate(updateType); -} - // NEO NOTE (Rain): doesn't seem to be implemented at all clientside? // Don't need to do this, unless we want it for prediction with proper implementation later. // Keeping it for now. @@ -2036,12 +1980,11 @@ void C_NEO_Player::CSpectatorTakeoverPlayerUpdate(C_NEO_Player* pPlayerTakeoverT m_bInLean = pPlayerTakeoverTarget->m_bInLean; m_flCamoAuxLastTime = pPlayerTakeoverTarget->m_flCamoAuxLastTime; - m_nVisionLastTick = pPlayerTakeoverTarget->m_nVisionLastTick; + m_flVisionLastTime = pPlayerTakeoverTarget->m_flVisionLastTime; m_flLastAirborneJumpOkTime = pPlayerTakeoverTarget->m_flLastAirborneJumpOkTime; m_flLastSuperJumpTime = pPlayerTakeoverTarget->m_flLastSuperJumpTime; m_bPreviouslyReloading = pPlayerTakeoverTarget->m_bPreviouslyReloading; m_bLastTickInThermOpticCamo = pPlayerTakeoverTarget->m_bLastTickInThermOpticCamo; - m_bIsAllowedToToggleVision = pPlayerTakeoverTarget->m_bIsAllowedToToggleVision; m_flTocFactor = pPlayerTakeoverTarget->m_flTocFactor; pPlayerTakeoverTarget->SnatchModelInstance(this); diff --git a/src/game/client/neo/c_neo_player.h b/src/game/client/neo/c_neo_player.h index 607d7185e..4066342e1 100644 --- a/src/game/client/neo/c_neo_player.h +++ b/src/game/client/neo/c_neo_player.h @@ -46,8 +46,6 @@ class C_NEO_Player : public C_HL2MP_Player virtual void AddEntity( void ); virtual void AddPoints(int score, bool bAllowNegativeScore, bool bIgnorePlayerTakeover = false); - virtual void PreDataUpdate(DataUpdateType_t updateType) OVERRIDE; - // Should this object cast shadows? virtual ShadowType_t ShadowCastType( void ); @@ -227,7 +225,7 @@ class C_NEO_Player : public C_HL2MP_Player CNetworkVar(bool, m_bHasBeenAirborneForTooLongToSuperJump); CNetworkVar(float, m_flCamoAuxLastTime); - CNetworkVar(int, m_nVisionLastTick); + CNetworkVar(float, m_flVisionLastTime); CNetworkVar(float, m_flJumpLastTime); CNetworkVar(float, m_flNextPingTime); @@ -263,7 +261,6 @@ class C_NEO_Player : public C_HL2MP_Player bool m_bFirstAliveTick; bool m_bFirstDeathTick; bool m_bPreviouslyReloading; - bool m_bIsAllowedToToggleVision; bool m_bSpecRefreshedStates; float m_flLastAirborneJumpOkTime; diff --git a/src/game/server/neo/neo_player.cpp b/src/game/server/neo/neo_player.cpp index 7e04b45bc..7fac75615 100644 --- a/src/game/server/neo/neo_player.cpp +++ b/src/game/server/neo/neo_player.cpp @@ -69,7 +69,7 @@ SendPropBool(SENDINFO(m_bIneligibleForLoadoutPick)), SendPropBool(SENDINFO(m_bCarryingGhost)), SendPropTime(SENDINFO(m_flCamoAuxLastTime)), -SendPropInt(SENDINFO(m_nVisionLastTick), -1, SPROP_UNSIGNED), +SendPropTime(SENDINFO(m_flVisionLastTime)), SendPropTime(SENDINFO(m_flJumpLastTime)), SendPropTime(SENDINFO(m_flNextPingTime)), @@ -109,7 +109,7 @@ DEFINE_FIELD(m_bShowTestMessage, FIELD_BOOLEAN), DEFINE_FIELD(m_bInAim, FIELD_BOOLEAN), DEFINE_FIELD(m_flCamoAuxLastTime, FIELD_TIME), -DEFINE_FIELD(m_nVisionLastTick, FIELD_TICK), +DEFINE_FIELD(m_flVisionLastTime, FIELD_TIME), DEFINE_FIELD(m_flJumpLastTime, FIELD_TIME), DEFINE_FIELD(m_flNextPingTime, FIELD_TIME), @@ -597,7 +597,7 @@ CNEO_Player::CNEO_Player() V_memset(m_pszTestMessage.GetForModify(), 0, sizeof(m_pszTestMessage)); m_flCamoAuxLastTime = 0; - m_nVisionLastTick = 0; + m_flVisionLastTime = 0; m_flLastAirborneJumpOkTime = 0; m_flLastSuperJumpTime = 0; m_botThermOpticCamoDisruptedTimer.Invalidate(); @@ -735,7 +735,7 @@ void CNEO_Player::Spawn(void) m_flCamoAuxLastTime = 0; m_bInVision = false; - m_nVisionLastTick = 0; + m_flVisionLastTime = 0; m_bInLean = NEO_LEAN_NONE; m_bCorpseSet = false; m_bAllowGibbing = true; @@ -832,65 +832,6 @@ void CNEO_Player::Lean(void) } } -void CNEO_Player::CheckVisionButtons() -{ - if (m_iNeoClass == NEO_CLASS_VIP) - return; - - if (gpGlobals->tickcount - m_nVisionLastTick < TIME_TO_TICKS(0.1f)) - { - return; - } - - if (m_afButtonPressed & IN_VISION) - { - if (IsAlive()) - { - m_nVisionLastTick = gpGlobals->tickcount; - - m_bInVision = !m_bInVision; - - if (m_bInVision) - { - CRecipientFilter filter; - - // NEO TODO/FIXME (Rain): optimise this loop to once per cycle instead of repeating for each client - for (int i = 1; i <= gpGlobals->maxClients; ++i) - { - if (edict()->m_EdictIndex == i) - { - continue; - } - - auto player = UTIL_PlayerByIndex(i); - if (!player || !player->IsDead() || player->GetObserverMode() != OBS_MODE_IN_EYE) - { - continue; - } - - if (player->GetObserverTarget() == this) - { - filter.AddRecipient(player); - } - } - - if (filter.GetRecipientCount() > 0) - { - static int visionToggle = CBaseEntity::PrecacheScriptSound("NeoPlayer.VisionOn"); - - EmitSound_t params; - params.m_bEmitCloseCaption = false; - params.m_hSoundScriptHandle = visionToggle; - params.m_pOrigin = &GetAbsOrigin(); - params.m_nChannel = CHAN_ITEM; - - EmitSound(filter, edict()->m_EdictIndex, params); - } - } - } - } -} - void CNEO_Player::CheckLeanButtons() { if (!IsAlive() || GetFlags() & FL_FROZEN) @@ -4358,7 +4299,7 @@ void CNEO_Player::SpectatorTakeoverPlayerPreThink() m_iBotDetectableBleedingInjuryEvents = pPlayerTakeoverTarget->m_iBotDetectableBleedingInjuryEvents; m_bInVision = pPlayerTakeoverTarget->m_bInVision; - m_nVisionLastTick = pPlayerTakeoverTarget->m_nVisionLastTick; + m_flVisionLastTime = pPlayerTakeoverTarget->m_flVisionLastTime; // Just clear this so the attackers scores/hits are based on only when it's // impersonated not including the bot controlled part diff --git a/src/game/server/neo/neo_player.h b/src/game/server/neo/neo_player.h index 7e5f7ac8a..e23f3772e 100644 --- a/src/game/server/neo/neo_player.h +++ b/src/game/server/neo/neo_player.h @@ -299,7 +299,7 @@ class CNEO_Player : public CHL2MP_Player CNetworkHandle(CBaseEntity, m_hServerRagdoll); CNetworkVar(float, m_flCamoAuxLastTime); - CNetworkVar(int, m_nVisionLastTick); + CNetworkVar(float, m_flVisionLastTime); CNetworkVar(float, m_flJumpLastTime); CNetworkVar(float, m_flNextPingTime); diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index 9eb432423..84d2bcad8 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -16,6 +16,7 @@ #include "c_neo_player.h" #include "c_playerresource.h" #include "ui/neo_hud_context_hint.h" +#include "prediction.h" #define CNEO_Player C_NEO_Player #else #include "neo_player.h" @@ -728,4 +729,85 @@ CBaseEntity *CNEO_Player::FindUseEntity() } return pNearest; -} \ No newline at end of file +} + +void CNEO_Player::CheckVisionButtons() +{ + if (m_iNeoClass == NEO_CLASS_VIP) + { + return; + } + + constexpr float MIN_INTERVAL_BETWEEN_VISION_TOGGLE = 0.1f; + if (gpGlobals->curtime - m_flVisionLastTime < MIN_INTERVAL_BETWEEN_VISION_TOGGLE) + { + return; + } + + if (!(m_afButtonPressed & IN_VISION)) + { + return; + } + + if (!IsAlive()) + { + return; + } + + m_flVisionLastTime = gpGlobals->curtime; + m_bInVision = !m_bInVision; + + if (!m_bInVision) + { + return; + } + +#ifdef CLIENT_DLL + if (prediction->IsFirstTimePredicted()) + { + DevMsg("Playing sound at :%f\n", gpGlobals->curtime); + } + + CLocalPlayerFilter filter; + filter.MakeReliable(); + filter.UsePredictionRules(); + +#else + CRecipientFilter filter; + + // NEO TODO/FIXME (Rain): optimise this loop to once per cycle instead of repeating for each client + for (int i = 1; i <= gpGlobals->maxClients; ++i) + { + if (edict()->m_EdictIndex == i) + { + continue; + } + + auto player = UTIL_PlayerByIndex(i); + if (!player || !player->IsDead() || player->GetObserverMode() != OBS_MODE_IN_EYE) + { + continue; + } + + if (player->GetObserverTarget() == this) + { + filter.AddRecipient(player); + } + } + + if (filter.GetRecipientCount() == 0) + { + return; + } +#endif // CLIENT_DLL + + EmitSound_t params; + params.m_bEmitCloseCaption = false; + params.m_pOrigin = &GetAbsOrigin(); + params.m_nChannel = CHAN_ITEM; + //params.m_nFlags |= SND_DO_NOT_OVERWRITE_EXISTING_ON_CHANNEL; + static int visionToggle = CBaseEntity::PrecacheScriptSound("NeoPlayer.VisionOn"); + params.m_hSoundScriptHandle = visionToggle; + + EmitSound(filter, entindex(), params); +} From 77259b1bb33aaf21450c92293d28746913f0030e Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Fri, 31 Jul 2026 17:21:54 +0100 Subject: [PATCH 2/6] restore flag to parity? --- src/game/shared/neo/neo_player_shared.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index 84d2bcad8..8e8f9f352 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -805,7 +805,7 @@ void CNEO_Player::CheckVisionButtons() params.m_bEmitCloseCaption = false; params.m_pOrigin = &GetAbsOrigin(); params.m_nChannel = CHAN_ITEM; - //params.m_nFlags |= SND_DO_NOT_OVERWRITE_EXISTING_ON_CHANNEL; + params.m_nFlags |= SND_DO_NOT_OVERWRITE_EXISTING_ON_CHANNEL; // NEO TODO (Adam) This sound only ever plays for the local player or spectate target, better to have a separate channel for this sound and allow overwriting existing sound imo static int visionToggle = CBaseEntity::PrecacheScriptSound("NeoPlayer.VisionOn"); params.m_hSoundScriptHandle = visionToggle; From c9ee46dd9a7082407937f2e25f7c6464db02f608 Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Fri, 31 Jul 2026 19:06:06 +0100 Subject: [PATCH 3/6] add vision off sound, separate vision toggle sound channel --- game/neo/scripts/game_sounds_player.txt | 9 +++++++++ src/game/server/neo/neo_client.cpp | 1 + src/game/shared/neo/neo_player_shared.cpp | 13 ++++--------- src/public/SoundParametersInternal.cpp | 1 + src/public/soundflags.h | 3 ++- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/game/neo/scripts/game_sounds_player.txt b/game/neo/scripts/game_sounds_player.txt index 1741ded4b..f670f6d20 100644 --- a/game/neo/scripts/game_sounds_player.txt +++ b/game/neo/scripts/game_sounds_player.txt @@ -32,6 +32,15 @@ "wave" "player/vision_on.wav" } +"NeoPlayer.VisionOff" +{ + "channel" "CHAN_ITEM" + "volume" "VOL_NORM" + "soundlevel" "SNDLVL_75dB" + + "wave" "player/vision_off.wav" +} + "NeoPlayer.RankUp" { "channel" "CHAN_ITEM" diff --git a/src/game/server/neo/neo_client.cpp b/src/game/server/neo/neo_client.cpp index 24d81fade..f4ca61367 100644 --- a/src/game/server/neo/neo_client.cpp +++ b/src/game/server/neo/neo_client.cpp @@ -327,6 +327,7 @@ void Precache_NEO_Sounds( void ) CBaseEntity::PrecacheScriptSound("NeoPlayer.ThermOpticOn"); CBaseEntity::PrecacheScriptSound("NeoPlayer.ThermOpticOff"); CBaseEntity::PrecacheScriptSound("NeoPlayer.VisionOn"); + CBaseEntity::PrecacheScriptSound("NeoPlayer.VisionOff"); } //----------------------------------------------------------------------------- diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index 8e8f9f352..46621f071 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -757,11 +757,6 @@ void CNEO_Player::CheckVisionButtons() m_flVisionLastTime = gpGlobals->curtime; m_bInVision = !m_bInVision; - if (!m_bInVision) - { - return; - } - #ifdef CLIENT_DLL if (prediction->IsFirstTimePredicted()) { @@ -804,10 +799,10 @@ void CNEO_Player::CheckVisionButtons() EmitSound_t params; params.m_bEmitCloseCaption = false; params.m_pOrigin = &GetAbsOrigin(); - params.m_nChannel = CHAN_ITEM; - params.m_nFlags |= SND_DO_NOT_OVERWRITE_EXISTING_ON_CHANNEL; // NEO TODO (Adam) This sound only ever plays for the local player or spectate target, better to have a separate channel for this sound and allow overwriting existing sound imo - static int visionToggle = CBaseEntity::PrecacheScriptSound("NeoPlayer.VisionOn"); - params.m_hSoundScriptHandle = visionToggle; + params.m_nChannel = CHAN_VISION; + static int VISION_ON = CBaseEntity::PrecacheScriptSound("NeoPlayer.VisionOn"); + static int VISION_OFF = CBaseEntity::PrecacheScriptSound("NeoPlayer.VisionOff"); + params.m_hSoundScriptHandle = m_bInVision ? VISION_ON : VISION_OFF; EmitSound(filter, entindex(), params); } diff --git a/src/public/SoundParametersInternal.cpp b/src/public/SoundParametersInternal.cpp index 4469650f4..fe1246151 100644 --- a/src/public/SoundParametersInternal.cpp +++ b/src/public/SoundParametersInternal.cpp @@ -41,6 +41,7 @@ static SoundChannels g_pChannelNames[] = { CHAN_VOICE_BASE, "CHAN_VOICE_BASE" }, { CHAN_USER_BASE, "CHAN_USER_BASE" }, { CHAN_GHOST_PICKUP, "CHAN_GHOST_PICKUP" }, + { CHAN_VISION, "CHAN_VISION" }, #endif }; diff --git a/src/public/soundflags.h b/src/public/soundflags.h index 88d499a4d..fd54f16fd 100644 --- a/src/public/soundflags.h +++ b/src/public/soundflags.h @@ -30,7 +30,8 @@ enum CHAN_VOICE_BASE = 8, // allocate channel for network voice data CHAN_USER_BASE = (CHAN_VOICE_BASE+128) // Anything >= this number is allocated to game code. #ifdef NEO - ,CHAN_GHOST_PICKUP = CHAN_USER_BASE, + ,CHAN_GHOST_PICKUP = CHAN_USER_BASE, + CHAN_VISION, #endif // NEO }; From c644d1541906b1fda2701710e65fc81fec63299b Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Fri, 31 Jul 2026 20:55:54 +0100 Subject: [PATCH 4/6] set channel in sound script --- game/neo/scripts/game_sounds_player.txt | 4 ++-- game/neo/scripts/game_sounds_ui.txt | 2 +- src/game/client/neo/c_neo_player.cpp | 4 ++-- src/game/server/neo/neo_message.cpp | 2 +- src/game/server/neo/neo_player.cpp | 3 +-- src/game/shared/neo/neo_player_shared.cpp | 2 +- 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/game/neo/scripts/game_sounds_player.txt b/game/neo/scripts/game_sounds_player.txt index f670f6d20..b772c35fc 100644 --- a/game/neo/scripts/game_sounds_player.txt +++ b/game/neo/scripts/game_sounds_player.txt @@ -25,7 +25,7 @@ "NeoPlayer.VisionOn" { - "channel" "CHAN_ITEM" + "channel" "137" // CHAN_VISION "volume" "VOL_NORM" "soundlevel" "SNDLVL_75dB" @@ -34,7 +34,7 @@ "NeoPlayer.VisionOff" { - "channel" "CHAN_ITEM" + "channel" "137" // CHAN_VISION "volume" "VOL_NORM" "soundlevel" "SNDLVL_75dB" diff --git a/game/neo/scripts/game_sounds_ui.txt b/game/neo/scripts/game_sounds_ui.txt index 47f326bf7..1bd1ea41d 100644 --- a/game/neo/scripts/game_sounds_ui.txt +++ b/game/neo/scripts/game_sounds_ui.txt @@ -92,7 +92,7 @@ "HUD.GhostPickUp" { - "channel" "CHAN_ITEM" + "channel" "136" // CHAN_GHOST_PICKUP "volume" "0.9" "pitch" "PITCH_NORM" diff --git a/src/game/client/neo/c_neo_player.cpp b/src/game/client/neo/c_neo_player.cpp index ea48ec77a..9b36f8525 100644 --- a/src/game/client/neo/c_neo_player.cpp +++ b/src/game/client/neo/c_neo_player.cpp @@ -1865,8 +1865,8 @@ void C_NEO_Player::PlayCloakSound(void) params.m_bEmitCloseCaption = false; params.m_hSoundScriptHandle = (m_bInThermOpticCamo ? tocOn : tocOff); params.m_pOrigin = &GetAbsOrigin(); - params.m_nChannel = CHAN_VOICE; - + params.m_nChannel = CHAN_VOICE; // NEO TODO (Adam) Changing the channel a sound is played on didn't work before I added the new flag SND_CHANGE_CHANNEL, use it here if we want this sound to actually play on CHAN_VOICE + EmitSound(filter, entindex(), params); } diff --git a/src/game/server/neo/neo_message.cpp b/src/game/server/neo/neo_message.cpp index cc886c901..d3c0b2ac3 100644 --- a/src/game/server/neo/neo_message.cpp +++ b/src/game/server/neo/neo_message.cpp @@ -87,7 +87,7 @@ void CNEO_Message::InputShowMessage(inputdata_t& inputData) filter.AddAllPlayers(); EmitSound_t ep; - ep.m_nChannel = CHAN_BODY; + ep.m_nChannel = CHAN_BODY; // NEO TODO (Adam) This doesn't change the channel this sound is played on, set correct channel in sound script ep.m_pSoundName = (char*)STRING(m_sSound); ep.m_flVolume = m_SoundVolume; ep.m_SoundLevel = ATTN_TO_SNDLVL(ATTN_NONE); diff --git a/src/game/server/neo/neo_player.cpp b/src/game/server/neo/neo_player.cpp index 7fac75615..411e1d746 100644 --- a/src/game/server/neo/neo_player.cpp +++ b/src/game/server/neo/neo_player.cpp @@ -1236,7 +1236,7 @@ void CNEO_Player::PlayCloakSound(bool removeLocalPlayer) params.m_bEmitCloseCaption = false; params.m_hSoundScriptHandle = (m_bInThermOpticCamo ? tocOn : tocOff); params.m_pOrigin = &GetAbsOrigin(); - params.m_nChannel = CHAN_VOICE; + params.m_nChannel = CHAN_VOICE; // NEO TODO (Adam) This doesn't change the channel this sound is played on, set correct channel in sound script EmitSound(filter, edict()->m_EdictIndex, params); @@ -4180,7 +4180,6 @@ void CNEO_Player::SpawnJuggernautPostDeath() { EmitSound_t soundParams; soundParams.m_pSoundName = "HUD.GhostPickUp"; - soundParams.m_nChannel = CHAN_GHOST_PICKUP; soundParams.m_bWarnOnDirectWaveReference = false; soundParams.m_bEmitCloseCaption = false; soundParams.m_SoundLevel = ATTN_TO_SNDLVL(ATTN_NONE); diff --git a/src/game/shared/neo/neo_player_shared.cpp b/src/game/shared/neo/neo_player_shared.cpp index 46621f071..8eca0124e 100644 --- a/src/game/shared/neo/neo_player_shared.cpp +++ b/src/game/shared/neo/neo_player_shared.cpp @@ -760,6 +760,7 @@ void CNEO_Player::CheckVisionButtons() #ifdef CLIENT_DLL if (prediction->IsFirstTimePredicted()) { + // NEO TODO (Adam) Is this still needed? DevMsg("Playing sound at :%f\n", gpGlobals->curtime); } @@ -799,7 +800,6 @@ void CNEO_Player::CheckVisionButtons() EmitSound_t params; params.m_bEmitCloseCaption = false; params.m_pOrigin = &GetAbsOrigin(); - params.m_nChannel = CHAN_VISION; static int VISION_ON = CBaseEntity::PrecacheScriptSound("NeoPlayer.VisionOn"); static int VISION_OFF = CBaseEntity::PrecacheScriptSound("NeoPlayer.VisionOff"); params.m_hSoundScriptHandle = m_bInVision ? VISION_ON : VISION_OFF; From 19a510fe794721efd73fb6bd164ef31bcd7d18f6 Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Fri, 31 Jul 2026 21:10:26 +0100 Subject: [PATCH 5/6] update comments, add disclaimer --- src/game/client/neo/c_neo_player.cpp | 2 +- src/public/soundflags.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/game/client/neo/c_neo_player.cpp b/src/game/client/neo/c_neo_player.cpp index 9b36f8525..5bfc8bd7c 100644 --- a/src/game/client/neo/c_neo_player.cpp +++ b/src/game/client/neo/c_neo_player.cpp @@ -1865,7 +1865,7 @@ void C_NEO_Player::PlayCloakSound(void) params.m_bEmitCloseCaption = false; params.m_hSoundScriptHandle = (m_bInThermOpticCamo ? tocOn : tocOff); params.m_pOrigin = &GetAbsOrigin(); - params.m_nChannel = CHAN_VOICE; // NEO TODO (Adam) Changing the channel a sound is played on didn't work before I added the new flag SND_CHANGE_CHANNEL, use it here if we want this sound to actually play on CHAN_VOICE + params.m_nChannel = CHAN_VOICE; // NEO TODO (Adam) This doesn't change the channel this sound is played on, set correct channel in sound script EmitSound(filter, entindex(), params); } diff --git a/src/public/soundflags.h b/src/public/soundflags.h index fd54f16fd..2db6016d3 100644 --- a/src/public/soundflags.h +++ b/src/public/soundflags.h @@ -30,6 +30,10 @@ enum CHAN_VOICE_BASE = 8, // allocate channel for network voice data CHAN_USER_BASE = (CHAN_VOICE_BASE+128) // Anything >= this number is allocated to game code. #ifdef NEO + // NEO NOTE (Adam) These cannot be used inside of sound scripts, nor does using them in code do much (EmitSound ignores the channel set in the EmitSound_t param passed to it). + // We could add a flag like SND_CHANGE_PITCH and SND_CHANGE_VOL, but the reason SND_CHANGE_CHANNEL doesn't exist is because it cannot be changed for already playing sounds. + // Still might be useful for sounds that aren't playing yet if theres some disclaimer attached to the flag I guess. If you add something like that please update this comment. + // For now add any channels you may need, then use the integer equivalent in the sound scripts. If any of the enums here change, remember to update all the soundscripts. ,CHAN_GHOST_PICKUP = CHAN_USER_BASE, CHAN_VISION, #endif // NEO From fc754db6f71b7b6116fe93992196521cec4a31c9 Mon Sep 17 00:00:00 2001 From: AdamTadeusz Date: Fri, 31 Jul 2026 21:17:32 +0100 Subject: [PATCH 6/6] update disclaimer --- src/public/soundflags.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/public/soundflags.h b/src/public/soundflags.h index 2db6016d3..10af89514 100644 --- a/src/public/soundflags.h +++ b/src/public/soundflags.h @@ -33,7 +33,8 @@ enum // NEO NOTE (Adam) These cannot be used inside of sound scripts, nor does using them in code do much (EmitSound ignores the channel set in the EmitSound_t param passed to it). // We could add a flag like SND_CHANGE_PITCH and SND_CHANGE_VOL, but the reason SND_CHANGE_CHANNEL doesn't exist is because it cannot be changed for already playing sounds. // Still might be useful for sounds that aren't playing yet if theres some disclaimer attached to the flag I guess. If you add something like that please update this comment. - // For now add any channels you may need, then use the integer equivalent in the sound scripts. If any of the enums here change, remember to update all the soundscripts. + // For now add any channels you may need here and in SoundParametersInternal.cpp, then use the integer equivalent in the sound scripts. + // If any of the enums here change, remember to update all the soundscripts. ,CHAN_GHOST_PICKUP = CHAN_USER_BASE, CHAN_VISION, #endif // NEO