This commit is contained in:
megascatterbomb 2025-04-04 00:44:36 -07:00 committed by GitHub
commit a3608018f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 21 additions and 7 deletions

View file

@ -56,7 +56,7 @@ IMPLEMENT_SERVERCLASS_ST_NOBASE(CBaseTeamObjectiveResource, DT_BaseTeamObjective
SendPropArray3( SENDINFO_ARRAY3(m_flCPTimerTimes), SendPropFloat( SENDINFO_ARRAY(m_flCPTimerTimes) ) ),
// state variables
SendPropArray3( SENDINFO_ARRAY3(m_iNumTeamMembers), SendPropInt( SENDINFO_ARRAY(m_iNumTeamMembers), 4, SPROP_UNSIGNED ) ),
SendPropArray3( SENDINFO_ARRAY3(m_iNumTeamMembers), SendPropInt( SENDINFO_ARRAY(m_iNumTeamMembers), MAX_TRANSMIT_CAPPERS_BITS, SPROP_UNSIGNED ) ),
SendPropArray3( SENDINFO_ARRAY3(m_iCappingTeam), SendPropInt( SENDINFO_ARRAY(m_iCappingTeam), 4, SPROP_UNSIGNED ) ),
SendPropArray3( SENDINFO_ARRAY3(m_iTeamInZone), SendPropInt( SENDINFO_ARRAY(m_iTeamInZone), 4, SPROP_UNSIGNED ) ),
SendPropArray3( SENDINFO_ARRAY3(m_bBlocked), SendPropInt( SENDINFO_ARRAY(m_bBlocked), 1, SPROP_UNSIGNED ) ),
@ -455,7 +455,7 @@ bool CBaseTeamObjectiveResource::TeamCanCapPoint( int index, int team )
void CBaseTeamObjectiveResource::SetNumPlayers( int index, int team, int iNumPlayers )
{
AssertValidIndex(index);
m_iNumTeamMembers.Set( TEAM_ARRAY( index, team ), iNumPlayers );
m_iNumTeamMembers.Set( TEAM_ARRAY( index, team ), MIN(iNumPlayers, MAX_TRANSMIT_CAPPERS));
UpdateCapHudElement();
}

View file

@ -12,6 +12,10 @@
#include "shareddefs.h"
// Number of bits used to transmit the number of point cappers to the client.
#define MAX_TRANSMIT_CAPPERS_BITS 4
#define MAX_TRANSMIT_CAPPERS (1 << MAX_TRANSMIT_CAPPERS_BITS) - 1
#define TEAM_ARRAY( index, team ) (index + (team * MAX_CONTROL_POINTS))
//-----------------------------------------------------------------------------

View file

@ -469,12 +469,20 @@ void CTriggerAreaCapture::CaptureThink( void )
float flReduction = flTimeDelta;
if ( CaptureModeScalesWithPlayers() )
{
// Diminishing returns for successive players.
for ( int i = 1; i < m_TeamData[m_nTeamInZone].iNumTouching; i++ )
{
#ifdef TF_DLL
// Diminishing returns for successive players. MAX_TRANSMIT_CAPPERS prevents overflow
for (int i = 1; i < m_TeamData[m_nTeamInZone].iNumTouching && i < MAX_TRANSMIT_CAPPERS; i++)
{
flReduction += (flTimeDelta / (float)(i+1));
flReduction += (flTimeDelta / (float)(i + 1));
}
#else
// Diminishing returns for successive players
for (int i = 1; i < m_TeamData[m_nTeamInZone].iNumTouching; i++)
{
flReduction += (flTimeDelta / (float)(i + 1));
}
#endif
}
m_flLastReductionTime = gpGlobals->curtime;

View file

@ -24,7 +24,9 @@ class CTeamTrainWatcher;
#define CAPTURE_CATCHUP_ALIVEPLAYERS 1
#define MAX_CLIENT_AREAS 128
#define MAX_AREA_CAPPERS 9
// Max number of cappers the server will transmit to the client as entity ids (for killfeed notification)
// not to be confused with MAX_TRANSMIT_CAPPERS in team_objectiveresource.h
#define MAX_AREA_CAPPERS 9
//-----------------------------------------------------------------------------
// Purpose: An area entity that players must remain in in order to active another entity