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
11 changes: 10 additions & 1 deletion game/neo/scripts/game_sounds_player.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,22 @@

"NeoPlayer.VisionOn"
{
"channel" "CHAN_ITEM"
"channel" "137" // CHAN_VISION
"volume" "VOL_NORM"
"soundlevel" "SNDLVL_75dB"

"wave" "player/vision_on.wav"
}

"NeoPlayer.VisionOff"
{
"channel" "137" // CHAN_VISION
"volume" "VOL_NORM"
"soundlevel" "SNDLVL_75dB"

"wave" "player/vision_off.wav"
}

"NeoPlayer.RankUp"
{
"channel" "CHAN_ITEM"
Expand Down
2 changes: 1 addition & 1 deletion game/neo/scripts/game_sounds_ui.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@

"HUD.GhostPickUp"
{
"channel" "CHAN_ITEM"
"channel" "136" // CHAN_GHOST_PICKUP
"volume" "0.9"
"pitch" "PITCH_NORM"

Expand Down
71 changes: 7 additions & 64 deletions src/game/client/neo/c_neo_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)),

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -458,15 +458,14 @@ 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;

m_bFirstAliveTick = true;
m_bFirstDeathTick = true;
m_bPreviouslyReloading = false;
m_bLastTickInThermOpticCamo = false;
m_bIsAllowedToToggleVision = false;
m_bSpecRefreshedStates = false;

m_flTocFactor = 0.15f;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -1904,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) This doesn't change the channel this sound is played on, set correct channel in sound script
EmitSound(filter, entindex(), params);
}

Expand All @@ -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.
Expand Down Expand Up @@ -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);
Expand Down
5 changes: 1 addition & 4 deletions src/game/client/neo/c_neo_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/game/server/neo/neo_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

//-----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/game/server/neo/neo_message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
72 changes: 6 additions & 66 deletions src/game/server/neo/neo_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down Expand Up @@ -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),

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -1295,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);

Expand Down Expand Up @@ -4239,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);
Expand Down Expand Up @@ -4358,7 +4298,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
Expand Down
2 changes: 1 addition & 1 deletion src/game/server/neo/neo_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Loading