Skip to content

Commit c25be0a

Browse files
committed
fix tf2 incompatibility by sperating the NPC patch into a define (BDSBASE_NPC)
1 parent b3ad4a1 commit c25be0a

File tree

107 files changed

+481
-347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+481
-347
lines changed

src/game/server/EntityDissolve.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ CEntityDissolve *CEntityDissolve::Create( CBaseEntity *pTarget, const char *pMat
232232
// Necessary to cause it to do the appropriate death cleanup
233233
if ( pTarget->m_lifeState == LIFE_ALIVE )
234234
{
235-
#ifdef BDSBASE
235+
#ifdef BDSBASE_NPC
236236
CBasePlayer* pPlayer = UTIL_GetLocalPlayer();
237237
#else
238238
CBasePlayer* pPlayer = UTIL_PlayerByIndex(1);
@@ -351,7 +351,7 @@ void CEntityDissolve::DissolveThink( void )
351351
// Necessary to cause it to do the appropriate death cleanup
352352
// Yeah, the player may have nothing to do with it, but
353353
// passing NULL to TakeDamage causes bad things to happen
354-
#ifdef BDSBASE
354+
#ifdef BDSBASE_NPC
355355
CBasePlayer* pPlayer = UTIL_GetNearestPlayer(GetAbsOrigin());
356356
#else
357357
CBasePlayer* pPlayer = UTIL_PlayerByIndex(1);

src/game/server/EnvHudHint.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ void CEnvHudHint::InputShowHudHint( inputdata_t &inputdata )
8989
}
9090
else
9191
{
92-
#ifdef BDSBASE
92+
#ifdef BDSBASE_NPC
9393
pPlayer = UTIL_GetNearestPlayer(GetAbsOrigin());
9494
#else
9595
pPlayer = UTIL_GetLocalPlayer();
@@ -130,7 +130,7 @@ void CEnvHudHint::InputHideHudHint( inputdata_t &inputdata )
130130
}
131131
else
132132
{
133-
#ifdef BDSBASE
133+
#ifdef BDSBASE_NPC
134134
pPlayer = UTIL_GetNearestPlayer(GetAbsOrigin());
135135
#else
136136
pPlayer = UTIL_GetLocalPlayer();

src/game/server/EnvMessage.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ void CMessage::InputShowMessage( inputdata_t &inputdata )
105105
}
106106
else
107107
{
108-
#ifdef BDSBASE
108+
#ifdef BDSBASE_NPC
109109
pPlayer = UTIL_GetLocalPlayer(); // just show it to the host, if there is one
110110
#else
111111
pPlayer = (gpGlobals->maxClients > 1) ? NULL : UTIL_GetLocalPlayer();
@@ -223,7 +223,7 @@ void CCredits::RollOutroCredits()
223223
{
224224
sv_unlockedchapters.SetValue( "15" );
225225

226-
#ifdef BDSBASE
226+
#ifdef BDSBASE_NPC
227227
CRecipientFilter filter;
228228
filter.AddAllPlayers();
229229
filter.MakeReliable();
@@ -252,7 +252,7 @@ void CCredits::InputRollOutroCredits( inputdata_t &inputdata )
252252

253253
void CCredits::InputShowLogo( inputdata_t &inputdata )
254254
{
255-
#ifdef BDSBASE
255+
#ifdef BDSBASE_NPC
256256
CRecipientFilter filter;
257257
filter.AddAllPlayers();
258258
filter.MakeReliable();
@@ -269,7 +269,7 @@ void CCredits::InputShowLogo( inputdata_t &inputdata )
269269

270270
if ( m_flLogoLength )
271271
{
272-
#ifdef BDSBASE
272+
#ifdef BDSBASE_NPC
273273
UserMessageBegin(filter, "LogoTimeMsg");
274274
#else
275275
UserMessageBegin(user, "LogoTimeMsg");
@@ -279,7 +279,7 @@ void CCredits::InputShowLogo( inputdata_t &inputdata )
279279
}
280280
else
281281
{
282-
#ifdef BDSBASE
282+
#ifdef BDSBASE_NPC
283283
UserMessageBegin(filter, "CreditsMsg");
284284
#else
285285
UserMessageBegin(user, "CreditsMsg");
@@ -296,7 +296,7 @@ void CCredits::InputSetLogoLength( inputdata_t &inputdata )
296296

297297
void CCredits::InputRollCredits( inputdata_t &inputdata )
298298
{
299-
#ifdef BDSBASE
299+
#ifdef BDSBASE_NPC
300300
CRecipientFilter filter;
301301
filter.AddAllPlayers();
302302
filter.MakeReliable();

src/game/server/ai_basenpc.cpp

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@
8787
#include "datacache/imdlcache.h"
8888
#include "vstdlib/jobthread.h"
8989

90-
#ifdef BDSBASE
90+
#ifdef BDSBASE_NPC
9191
#ifdef HL2MP
9292
//TDT - Information: Here we include the hl2mp gamerules.
9393
#include "hl2mp_gamerules.h"
94-
#endif //BDSBASE
94+
#endif
9595
#endif //BDSBASE
9696

9797
#ifdef HL2_EPISODIC
@@ -261,7 +261,7 @@ int CAI_Manager::NumAIs()
261261

262262
//-------------------------------------
263263

264-
#ifdef BDSBASE
264+
#ifdef BDSBASE_NPC
265265
int CAI_Manager::AddAI(CAI_BaseNPC* pAI)
266266
{
267267
m_AIs.AddToTail(pAI);
@@ -657,7 +657,7 @@ void CAI_BaseNPC::Ignite( float flFlameLifetime, bool bNPCOnly, float flSize, bo
657657
{
658658
BaseClass::Ignite( flFlameLifetime, bNPCOnly, flSize, bCalledByLevelDesigner );
659659

660-
#ifdef BDSBASE
660+
#ifdef BDSBASE_NPC
661661
/*#ifdef HL2_EPISODIC
662662
if ( AI_IsSinglePlayer() )
663663
{
@@ -813,11 +813,11 @@ int CAI_BaseNPC::OnTakeDamage_Alive( const CTakeDamageInfo &info )
813813
{
814814
// See if the person that injured me is an NPC.
815815
CAI_BaseNPC *pAttacker = dynamic_cast<CAI_BaseNPC *>( info.GetAttacker() );
816-
#ifndef BDSBASE
816+
#ifndef BDSBASE_NPC
817817
CBasePlayer* pPlayer = AI_GetSinglePlayer();
818818
#endif //BDSBASE
819819

820-
#ifdef BDSBASE
820+
#ifdef BDSBASE_NPC
821821
if (pAttacker && pAttacker->IsAlive() && UTIL_GetNearestPlayer(GetAbsOrigin()))
822822
#else
823823
if (pAttacker && pAttacker->IsAlive() && pPlayer)
@@ -3152,7 +3152,7 @@ void CAI_BaseNPC::UpdateEfficiency( bool bInPVS )
31523152

31533153
//---------------------------------
31543154

3155-
#ifdef BDSBASE
3155+
#ifdef BDSBASE_NPC
31563156
CBasePlayer* pPlayer = UTIL_GetNearestPlayer(GetAbsOrigin());
31573157
#else
31583158
CBasePlayer* pPlayer = AI_GetSinglePlayer();
@@ -3268,7 +3268,7 @@ void CAI_BaseNPC::UpdateEfficiency( bool bInPVS )
32683268
}
32693269
}
32703270

3271-
#ifdef BDSBASE
3271+
#ifdef BDSBASE_NPC
32723272
if (pCurrentSound)
32733273
iSound = pCurrentSound->NextSound();
32743274
else
@@ -3407,7 +3407,7 @@ void CAI_BaseNPC::UpdateSleepState( bool bInPVS )
34073407
{
34083408
if ( GetSleepState() > AISS_AWAKE )
34093409
{
3410-
#ifdef BDSBASE
3410+
#ifdef BDSBASE_NPC
34113411
CBasePlayer* pLocalPlayer = UTIL_GetNearestPlayer(GetAbsOrigin());
34123412
#else
34133413
CBasePlayer* pLocalPlayer = AI_GetSinglePlayer();
@@ -3466,7 +3466,7 @@ void CAI_BaseNPC::UpdateSleepState( bool bInPVS )
34663466
break;
34673467
}
34683468

3469-
#ifdef BDSBASE
3469+
#ifdef BDSBASE_NPC
34703470
if (pCurrentSound)
34713471
iSound = pCurrentSound->NextSound();
34723472
else
@@ -3618,7 +3618,7 @@ void CAI_BaseNPC::RebalanceThinks()
36183618

36193619
int i;
36203620

3621-
#ifdef BDSBASE
3621+
#ifdef BDSBASE_NPC
36223622
CBasePlayer* pPlayer = UTIL_GetNearestPlayer(GetAbsOrigin());
36233623
#else
36243624
CBasePlayer* pPlayer = AI_GetSinglePlayer();
@@ -3903,7 +3903,7 @@ void CAI_BaseNPC::SetPlayerAvoidState( void )
39033903

39043904
GetPlayerAvoidBounds( &vMins, &vMaxs );
39053905

3906-
#ifdef BDSBASE
3906+
#ifdef BDSBASE_NPC
39073907
CBasePlayer* pLocalPlayer = UTIL_GetNearestPlayer(GetAbsOrigin());
39083908
#else
39093909
CBasePlayer* pLocalPlayer = AI_GetSinglePlayer();
@@ -4882,7 +4882,7 @@ void CAI_BaseNPC::RunAI( void )
48824882
}
48834883
}
48844884

4885-
#ifdef BDSBASE
4885+
#ifdef BDSBASE_NPC
48864886
if (ai_debug_loners.GetBool() && !IsInSquad())
48874887
#else
48884888
if (ai_debug_loners.GetBool() && !IsInSquad() && AI_IsSinglePlayer())
@@ -4893,7 +4893,7 @@ void CAI_BaseNPC::RunAI( void )
48934893

48944894
vecPoint = EyePosition() + Vector( 0, 0, 12 );
48954895

4896-
#ifdef BDSBASE
4896+
#ifdef BDSBASE_NPC
48974897
UTIL_GetNearestPlayer(GetAbsOrigin())->GetVectors(NULL, &right, NULL);
48984898
#else
48994899
UTIL_GetLocalPlayer()->GetVectors(NULL, &right, NULL);
@@ -8757,7 +8757,7 @@ void CAI_BaseNPC::DrawDebugGeometryOverlays(void)
87578757

87588758
info.SetDamage( m_iHealth );
87598759
info.SetAttacker( this );
8760-
#ifdef BDSBASE
8760+
#ifdef BDSBASE_NPC
87618761
info.SetInflictor((CBaseEntity*)this);
87628762
#else
87638763
info.SetInflictor((AI_IsSinglePlayer()) ? (CBaseEntity*)AI_GetSinglePlayer() : (CBaseEntity*)this);
@@ -9992,7 +9992,7 @@ CBaseEntity *CAI_BaseNPC::FindNamedEntity( const char *name, IEntityFindFilter *
99929992
{
99939993
if ( !stricmp( name, "!player" ))
99949994
{
9995-
#ifdef BDSBASE
9995+
#ifdef BDSBASE_NPC
99969996
return UTIL_GetNearestPlayer(GetAbsOrigin());
99979997
#else
99989998
return (CBaseEntity*)AI_GetSinglePlayer();
@@ -10011,7 +10011,7 @@ CBaseEntity *CAI_BaseNPC::FindNamedEntity( const char *name, IEntityFindFilter *
1001110011
{
1001210012
// FIXME: look at CBaseEntity *CNPCSimpleTalker::FindNearestFriend(bool fPlayer)
1001310013
// punt for now
10014-
#ifdef BDSBASE
10014+
#ifdef BDSBASE_NPC
1001510015
return UTIL_GetNearestPlayer(GetAbsOrigin());
1001610016
#else
1001710017
return (CBaseEntity*)AI_GetSinglePlayer();
@@ -10035,7 +10035,7 @@ CBaseEntity *CAI_BaseNPC::FindNamedEntity( const char *name, IEntityFindFilter *
1003510035
{
1003610036
DevMsg( "ERROR: \"player\" is no longer used, use \"!player\" in vcd instead!\n" );
1003710037
}
10038-
#ifdef BDSBASE
10038+
#ifdef BDSBASE_NPC
1003910039
return UTIL_GetNearestPlayer(GetAbsOrigin());
1004010040
#else
1004110041
return (CBaseEntity*)AI_GetSinglePlayer();
@@ -11468,7 +11468,7 @@ CAI_BaseNPC::CAI_BaseNPC(void)
1146811468
m_interuptSchedule = NULL;
1146911469
m_nDebugPauseIndex = 0;
1147011470

11471-
#ifdef BDSBASE
11471+
#ifdef BDSBASE_NPC
1147211472
SetAIIndex(g_AI_Manager.AddAI(this));
1147311473
#else
1147411474
g_AI_Manager.AddAI(this);
@@ -12016,7 +12016,7 @@ bool CAI_BaseNPC::CineCleanup()
1201612016
{
1201712017
SetLocalOrigin( origin );
1201812018

12019-
#ifdef BDSBASE
12019+
#ifdef BDSBASE_NPC
1202012020
int drop = UTIL_DropToFloor(this, MASK_NPCSOLID, UTIL_GetNearestVisiblePlayer(this));
1202112021
#else
1202212022
int drop = UTIL_DropToFloor(this, MASK_NPCSOLID, UTIL_GetLocalPlayer());
@@ -12097,7 +12097,7 @@ void CAI_BaseNPC::Teleport( const Vector *newPosition, const QAngle *newAngles,
1209712097

1209812098
bool CAI_BaseNPC::FindSpotForNPCInRadius( Vector *pResult, const Vector &vStartPos, CAI_BaseNPC *pNPC, float radius, bool bOutOfPlayerViewcone )
1209912099
{
12100-
#ifdef BDSBASE
12100+
#ifdef BDSBASE_NPC
1210112101
CBasePlayer* pPlayer = UTIL_GetNearestPlayer(pNPC->GetAbsOrigin());
1210212102
#else
1210312103
CBasePlayer* pPlayer = AI_GetSinglePlayer();
@@ -12635,13 +12635,13 @@ bool CAI_BaseNPC::IsPlayerAlly( CBasePlayer *pPlayer )
1263512635
{
1263612636
if ( pPlayer == NULL )
1263712637
{
12638-
#ifndef BDSBASE
12638+
#ifndef BDSBASE_NPC
1263912639
if (!AI_IsSinglePlayer())
1264012640
return false;
1264112641
#endif //BDSBASE
1264212642

1264312643
// NULL means single player mode
12644-
#ifdef BDSBASE
12644+
#ifdef BDSBASE_NPC
1264512645
pPlayer = UTIL_GetNearestPlayer(GetAbsOrigin());
1264612646
#else
1264712647
pPlayer = UTIL_GetLocalPlayer();
@@ -12939,7 +12939,7 @@ bool CAI_BaseNPC::FindNearestValidGoalPos( const Vector &vTestPoint, Vector *pRe
1293912939

1294012940
if ( vCandidate != vec3_invalid )
1294112941
{
12942-
#ifdef BDSBASE
12942+
#ifdef BDSBASE_NPC
1294312943
AI_Waypoint_t* pPathToPoint = GetPathfinder()->BuildRoute(GetAbsOrigin(), vCandidate, UTIL_GetNearestPlayer(GetAbsOrigin()), 5 * 12, NAV_NONE, true);
1294412944
#else
1294512945
AI_Waypoint_t* pPathToPoint = GetPathfinder()->BuildRoute(GetAbsOrigin(), vCandidate, AI_GetSinglePlayer(), 5 * 12, NAV_NONE, true);
@@ -14083,7 +14083,7 @@ void CAI_BaseNPC::PlayerHasIlluminatedNPC( CBasePlayer *pPlayer, float flDot )
1408314083
if ( pInteraction->iLoopBreakTriggerMethod & SNPCINT_LOOPBREAK_ON_FLASHLIGHT_ILLUM )
1408414084
{
1408514085
// Only do this in alyx darkness mode
14086-
#ifdef BDSBASE
14086+
#ifdef BDSBASE_NPC
1408714087
if (HL2MPRules()->IsAlyxInDarknessMode())
1408814088
#else
1408914089
if (HL2GameRules()->IsAlyxInDarknessMode())

src/game/server/ai_basenpc.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ float ChangeDistance( float flInterval, float flGoalDistance, float flGoalVeloci
446446
//
447447
//=============================================================================
448448

449-
#ifdef BDSBASE
449+
#ifdef BDSBASE_NPC
450450
#define MAX_AIS 256
451451
#endif //BDSBASE
452452

@@ -458,7 +458,7 @@ class CAI_Manager
458458
CAI_BaseNPC ** AccessAIs();
459459
int NumAIs();
460460

461-
#ifdef BDSBASE
461+
#ifdef BDSBASE_NPC
462462
int AddAI(CAI_BaseNPC* pAI);
463463
#else
464464
void AddAI(CAI_BaseNPC* pAI);
@@ -468,7 +468,7 @@ class CAI_Manager
468468
bool FindAI( CAI_BaseNPC *pAI ) { return ( m_AIs.Find( pAI ) != m_AIs.InvalidIndex() ); }
469469

470470
private:
471-
#ifndef BDSBASE
471+
#ifndef BDSBASE_NPC
472472
enum
473473
{
474474
MAX_AIS = 256
@@ -2132,7 +2132,7 @@ class CAI_BaseNPC : public CBaseCombatCharacter,
21322132
void GetPlayerAvoidBounds( Vector *pMins, Vector *pMaxs );
21332133

21342134
void StartPingEffect( void ) { m_flTimePingEffect = gpGlobals->curtime + 2.0f; DispatchUpdateTransmitState(); }
2135-
#ifdef BDSBASE
2135+
#ifdef BDSBASE_NPC
21362136
// used by lag compensation to be able to refer to & track specific NPCs, and detect changes in the AI list
21372137
void SetAIIndex(int i) { m_iAIIndex = i; }
21382138
int GetAIIndex() { return m_iAIIndex; }

src/game/server/ai_basenpc_schedule.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3363,7 +3363,7 @@ void CAI_BaseNPC::RunTask( const Task_t *pTask )
33633363
case TASK_FACE_PLAYER:
33643364
{
33653365
// Get edict for one player
3366-
#ifdef BDSBASE
3366+
#ifdef BDSBASE_NPC
33673367
CBasePlayer* pPlayer = UTIL_GetNearestVisiblePlayer(this);
33683368
#else
33693369
CBasePlayer* pPlayer = AI_GetSinglePlayer();
@@ -3665,7 +3665,7 @@ void CAI_BaseNPC::RunTask( const Task_t *pTask )
36653665

36663666
if( pHint )
36673667
{
3668-
#ifdef BDSBASE
3668+
#ifdef BDSBASE_NPC
36693669
CBasePlayer* pPlayer = UTIL_GetNearestPlayer(GetAbsOrigin());
36703670
#else
36713671
CBasePlayer* pPlayer = AI_GetSinglePlayer();

src/game/server/ai_behavior_fear.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ void CAI_FearBehavior::GatherConditions()
318318
// -I haven't seen the player in 2 seconds
319319
//
320320
// Here's the distance check:
321-
#ifdef BDSBASE
321+
#ifdef BDSBASE_NPC
322322
CBasePlayer* pPlayer = UTIL_GetNearestPlayer(GetAbsOrigin());
323323
#else
324324
CBasePlayer* pPlayer = AI_GetSinglePlayer();
@@ -461,7 +461,7 @@ CAI_Hint *CAI_FearBehavior::FindFearWithdrawalDest()
461461

462462
hintCriteria.AddHintType( HINT_PLAYER_ALLY_FEAR_DEST );
463463
hintCriteria.SetFlag( bits_HINT_NODE_VISIBLE_TO_PLAYER | bits_HINT_NOT_CLOSE_TO_ENEMY /*| bits_HINT_NODE_IN_VIEWCONE | bits_HINT_NPC_IN_NODE_FOV*/ );
464-
#ifdef BDSBASE
464+
#ifdef BDSBASE_NPC
465465
hintCriteria.AddIncludePosition(UTIL_GetNearestPlayer(GetAbsOrigin())->GetAbsOrigin(), (ai_fear_player_dist.GetFloat()));
466466
#else
467467
hintCriteria.AddIncludePosition(AI_GetSinglePlayer()->GetAbsOrigin(), (ai_fear_player_dist.GetFloat()));

src/game/server/ai_behavior_follow.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@
1818
#include "ndebugoverlay.h"
1919
#include "ai_senses.h"
2020

21+
#ifdef BDSBASE_NPC
2122
//TDT - Episodic Issues: Here we include the hl2mp gamerules so that calls to darkness mode work.
2223
#ifdef HL2MP
23-
#include "hl2mp_gamerules.h"
24+
#include "hl2mp_gamerules.h"
25+
#endif
2426
#endif
2527

2628
#ifdef HL2_EPISODIC
@@ -2135,7 +2137,7 @@ void CAI_FollowGoal::EnableGoal( CAI_BaseNPC *pAI )
21352137
return;
21362138

21372139
CBaseEntity *pGoalEntity = GetGoalEntity();
2138-
#ifdef BDSBASE
2140+
#ifdef BDSBASE_NPC
21392141
if (!pGoalEntity)
21402142
{
21412143
CBasePlayer* pPlayer = UTIL_GetNearestPlayer(GetAbsOrigin());

0 commit comments

Comments
 (0)