Skip to content

Commit 456821c

Browse files
committed
1 parent ca5012a commit 456821c

File tree

4 files changed

+64
-1
lines changed

4 files changed

+64
-1
lines changed

src/game/server/info_camera_link.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,17 @@ CBaseEntity *CreateInfoCameraLink( CBaseEntity *pTarget, CPointCamera *pCamera )
145145
//-----------------------------------------------------------------------------
146146
void PointCameraSetupVisibility( CBaseEntity *pPlayer, int area, unsigned char *pvs, int pvssize )
147147
{
148+
#ifdef BDSBASE
149+
int nPlayerIndex = pPlayer->entindex();
150+
#endif
151+
148152
for ( CPointCamera *pCameraEnt = GetPointCameraList(); pCameraEnt != NULL; pCameraEnt = pCameraEnt->m_pNext )
149153
{
154+
#ifdef BDSBASE
155+
pCameraEnt->TransmitToPlayer(nPlayerIndex, false);
156+
#else
150157
pCameraEnt->SetActive( false );
158+
#endif
151159
}
152160

153161
intp nNext;
@@ -175,7 +183,11 @@ void PointCameraSetupVisibility( CBaseEntity *pPlayer, int area, unsigned char *
175183
if ( pCameraEnt )
176184
{
177185
engine->AddOriginToPVS( pCameraEnt->GetAbsOrigin() );
178-
pCameraEnt->SetActive( true );
186+
#ifdef BDSBASE
187+
pCameraEnt->TransmitToPlayer(nPlayerIndex, true);
188+
#else
189+
pCameraEnt->SetActive(true);
190+
#endif
179191
}
180192
}
181193
}

src/game/server/point_camera.cpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,28 @@ CPointCamera::CPointCamera()
5252
m_bFogEnable = false;
5353
m_bFogRadial = false;
5454

55+
#ifdef BDSBASE
56+
// By default, transmit to everyone
57+
m_bitsTransmitPlayers.SetAll();
58+
#endif
59+
5560
g_PointCameraList.Insert( this );
5661
}
5762

63+
#ifdef BDSBASE
64+
//-----------------------------------------------------------------------------
65+
// Purpose: Transmit only to players who are in PVS of the camera and its link
66+
// See PointCameraSetupVisibility
67+
//-----------------------------------------------------------------------------
68+
int CPointCamera::ShouldTransmit(const CCheckTransmitInfo* pInfo)
69+
{
70+
if (m_bitsTransmitPlayers.IsBitSet(pInfo->m_pClientEnt->m_EdictIndex))
71+
return FL_EDICT_ALWAYS;
72+
73+
return FL_EDICT_DONTSEND;
74+
}
75+
#endif
76+
5877
//-----------------------------------------------------------------------------
5978
// Purpose:
6079
//-----------------------------------------------------------------------------
@@ -80,6 +99,9 @@ void CPointCamera::Spawn( void )
8099
//-----------------------------------------------------------------------------
81100
int CPointCamera::UpdateTransmitState()
82101
{
102+
#ifdef BDSBASE
103+
return SetTransmitState(FL_EDICT_FULLCHECK);
104+
#else
83105
if ( m_bActive )
84106
{
85107
return SetTransmitState( FL_EDICT_ALWAYS );
@@ -88,19 +110,34 @@ int CPointCamera::UpdateTransmitState()
88110
{
89111
return SetTransmitState( FL_EDICT_DONTSEND );
90112
}
113+
#endif
91114
}
92115

116+
#ifdef BDSBASE
117+
//-----------------------------------------------------------------------------
118+
// Purpose: Toggle networking of the camera to the specified player
119+
//-----------------------------------------------------------------------------
120+
void CPointCamera::TransmitToPlayer(int nPlayerIndex, bool bTransmit)
121+
{
122+
if (bTransmit)
123+
m_bitsTransmitPlayers.Set(nPlayerIndex);
124+
else
125+
m_bitsTransmitPlayers.Clear(nPlayerIndex);
126+
}
127+
#endif
93128

94129
//-----------------------------------------------------------------------------
95130
// Purpose:
96131
//-----------------------------------------------------------------------------
97132
void CPointCamera::SetActive( bool bActive )
98133
{
134+
#ifndef BDSBASE
99135
// If the mapmaker's told the camera it's off, it enforces inactive state
100136
if ( !m_bIsOn )
101137
{
102138
bActive = false;
103139
}
140+
#endif
104141

105142
if ( m_bActive != bActive )
106143
{

src/game/server/point_camera.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@ class CPointCamera : public CBaseEntity
2929

3030
// Tell the client that this camera needs to be rendered
3131
void SetActive( bool bActive );
32+
#ifdef BDSBASE
33+
int ShouldTransmit(const CCheckTransmitInfo* pInfo);
3234
int UpdateTransmitState(void);
35+
void TransmitToPlayer(int nPlayerIndex, bool bTransmit);
36+
#else
37+
int UpdateTransmitState(void);
38+
#endif
3339

3440
void ChangeFOVThink( void );
3541

@@ -56,6 +62,10 @@ class CPointCamera : public CBaseEntity
5662
// Allows the mapmaker to control whether a camera is active or not
5763
bool m_bIsOn;
5864

65+
#ifdef BDSBASE
66+
CBitVec< MAX_PLAYERS > m_bitsTransmitPlayers;
67+
#endif
68+
5969
public:
6070
CPointCamera *m_pNext;
6171
};

src/game/shared/tf/tf_weaponbase.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2395,7 +2395,11 @@ void CTFWeaponBase::SetReloadTimer( float flReloadTime )
23952395

23962396

23972397
int numHealers = pPlayer->m_Shared.GetNumHealers();
2398+
#ifdef BDSBASE
2399+
if (numHealers >= 1)
2400+
#else
23982401
if ( numHealers == 1 )
2402+
#endif
23992403
{
24002404
CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( pPlayer, flReloadTime, mult_reload_time_while_healed );
24012405
}

0 commit comments

Comments
 (0)