Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

739 lines
30 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. #include "cbase.h"
  3. #include "hl1mp_gamerules.h"
  4. #include "viewport_panel_names.h"
  5. #include "gameeventdefs.h"
  6. #include <KeyValues.h>
  7. #include "ammodef.h"
  8. #ifdef CLIENT_DLL
  9. #include "hl1/c_hl1mp_player.h"
  10. #else
  11. #include "eventqueue.h"
  12. #include "player.h"
  13. #include "gamerules.h"
  14. #include "game.h"
  15. #include "items.h"
  16. #include "entitylist.h"
  17. #include "in_buttons.h"
  18. #include <ctype.h>
  19. #include "voice_gamemgr.h"
  20. #include "iscorer.h"
  21. #include "hl1mp_player.h"
  22. #include "team.h"
  23. #include "voice_gamemgr.h"
  24. #ifdef DEBUG
  25. #include "hl1mp_bot_temp.h"
  26. #endif
  27. ConVar sv_hl1mp_weapon_respawn_time( "sv_hl1mp_weapon_respawn_time", "20", FCVAR_GAMEDLL | FCVAR_NOTIFY );
  28. ConVar sv_hl1mp_item_respawn_time( "sv_hl1mp_item_respawn_time", "30", FCVAR_GAMEDLL | FCVAR_NOTIFY );
  29. extern ConVar mp_chattime;
  30. extern CBaseEntity *g_pLastCombineSpawn;
  31. extern CBaseEntity *g_pLastRebelSpawn;
  32. //#define WEAPON_MAX_DISTANCE_FROM_SPAWN 64
  33. #endif
  34. REGISTER_GAMERULES_CLASS( CHL1MPRules );
  35. BEGIN_NETWORK_TABLE_NOBASE( CHL1MPRules, DT_HL1MPRules )
  36. #ifdef CLIENT_DLL
  37. RecvPropBool( RECVINFO( m_bTeamPlayEnabled ) ),
  38. #else
  39. SendPropBool( SENDINFO( m_bTeamPlayEnabled ) ),
  40. #endif
  41. END_NETWORK_TABLE()
  42. LINK_ENTITY_TO_CLASS( hl1mp_gamerules, CHL1MPGameRulesProxy );
  43. IMPLEMENT_NETWORKCLASS_ALIASED( HL1MPGameRulesProxy, DT_HL1MPGameRulesProxy )
  44. #ifdef CLIENT_DLL
  45. void RecvProxy_HL1MPRules( const RecvProp *pProp, void **pOut, void *pData, int objectID )
  46. {
  47. CHL1MPRules *pRules = HL1MPRules();
  48. Assert( pRules );
  49. *pOut = pRules;
  50. }
  51. BEGIN_RECV_TABLE( CHL1MPGameRulesProxy, DT_HL1MPGameRulesProxy )
  52. RecvPropDataTable( "hl1mp_gamerules_data", 0, 0, &REFERENCE_RECV_TABLE( DT_HL1MPRules ), RecvProxy_HL1MPRules )
  53. END_RECV_TABLE()
  54. #else
  55. void* SendProxy_HL1MPRules( const SendProp *pProp, const void *pStructBase, const void *pData, CSendProxyRecipients *pRecipients, int objectID )
  56. {
  57. CHL1MPRules *pRules = HL1MPRules();
  58. Assert( pRules );
  59. return pRules;
  60. }
  61. BEGIN_SEND_TABLE( CHL1MPGameRulesProxy, DT_HL1MPGameRulesProxy )
  62. SendPropDataTable( "hl1mp_gamerules_data", 0, &REFERENCE_SEND_TABLE( DT_HL1MPRules ), SendProxy_HL1MPRules )
  63. END_SEND_TABLE()
  64. #endif
  65. #ifndef CLIENT_DLL
  66. #if 0
  67. class CVoiceGameMgrHelper : public IVoiceGameMgrHelper
  68. {
  69. public:
  70. virtual bool CanPlayerHearPlayer( CBasePlayer *pListener, CBasePlayer *pTalker )
  71. {
  72. return ( pListener->GetTeamNumber() == pTalker->GetTeamNumber() );
  73. }
  74. };
  75. CVoiceGameMgrHelper g_VoiceGameMgrHelper;
  76. IVoiceGameMgrHelper *g_pVoiceGameMgrHelper = &g_VoiceGameMgrHelper;
  77. #endif
  78. #ifdef DEBUG
  79. // Handler for the "bot" command.
  80. void Bot_f()
  81. {
  82. // Look at -count.
  83. int count = 1;
  84. count = clamp( count, 1, 16 );
  85. int iTeam = 0;
  86. // Look at -frozen.
  87. bool bFrozen = false;
  88. // Ok, spawn all the bots.
  89. while ( --count >= 0 )
  90. {
  91. BotPutInServer( bFrozen, iTeam );
  92. }
  93. }
  94. ConCommand cc_Bot( "bot", Bot_f, "Add a bot.", FCVAR_CHEAT );
  95. #endif
  96. #endif
  97. CHL1MPRules::CHL1MPRules()
  98. {
  99. #ifndef CLIENT_DLL
  100. m_bTeamPlayEnabled = teamplay.GetBool();
  101. if ( IsTeamplay() )
  102. {
  103. // Create basic server teams
  104. CTeam *pTeam = static_cast<CTeam*>(CreateEntityByName( "team_manager" ));
  105. pTeam->Init( "Unassigned", 0 );
  106. g_Teams.AddToTail( pTeam );
  107. pTeam = static_cast<CTeam*>(CreateEntityByName( "team_manager" ));
  108. pTeam->Init( "Spectator", 1 );
  109. g_Teams.AddToTail( pTeam );
  110. char *pName;
  111. char szTeamlist[TEAMPLAY_TEAMLISTLENGTH];
  112. // loop through all teams, recounting everything
  113. int num_teams = 0;
  114. // Copy all of the teams from the teamlist
  115. // make a copy because strtok is destructive
  116. Q_strncpy( szTeamlist, teamlist.GetString(), sizeof(teamlist) );
  117. pName = szTeamlist;
  118. pName = strtok( pName, "," );
  119. while ( pName != NULL && *pName )
  120. {
  121. if ( GetTeamIndex( pName ) < 0 )
  122. {
  123. // create team
  124. pTeam = static_cast<CTeam*>(CreateEntityByName( "team_manager" ));
  125. pTeam->Init( pName, num_teams + 2 );
  126. g_Teams.AddToTail( pTeam );
  127. num_teams++;
  128. }
  129. pName = strtok( NULL, "," );
  130. }
  131. // Manually create teams
  132. if ( num_teams == 0 )
  133. {
  134. pTeam = static_cast<CTeam*>(CreateEntityByName( "team_manager" ) );
  135. pTeam->Init( "robo", num_teams + 2 );
  136. g_Teams.AddToTail( pTeam );
  137. num_teams++;
  138. pTeam = static_cast<CTeam*>(CreateEntityByName( "team_manager" ) );
  139. pTeam->Init( "hgrunt", num_teams + 2 );
  140. g_Teams.AddToTail( pTeam );
  141. num_teams++;
  142. }
  143. }
  144. #endif
  145. }
  146. CHL1MPRules::~CHL1MPRules( void )
  147. {
  148. #ifndef CLIENT_DLL
  149. // Note, don't delete each team since they are in the gEntList and will
  150. // automatically be deleted from there, instead.
  151. g_Teams.Purge();
  152. #endif
  153. }
  154. void CHL1MPRules::CreateStandardEntities( void )
  155. {
  156. #ifndef CLIENT_DLL
  157. // Create the entity that will send our data to the client.
  158. BaseClass::CreateStandardEntities();
  159. #ifdef _DEBUG
  160. CBaseEntity *pEnt =
  161. #endif
  162. CBaseEntity::Create( "hl1mp_gamerules", vec3_origin, vec3_angle );
  163. Assert( pEnt );
  164. #endif
  165. }
  166. float CHL1MPRules::GetAmmoDamage( CBaseEntity *pAttacker, CBaseEntity *pVictim, int nAmmoType )
  167. {
  168. return BaseClass::GetAmmoDamage( pAttacker, pVictim, nAmmoType ) * GetDamageMultiplier();
  169. }
  170. float CHL1MPRules::GetDamageMultiplier( void )
  171. {
  172. if ( IsMultiplayer() )
  173. return sk_mp_dmg_multiplier.GetFloat();
  174. else
  175. return 1.0f;
  176. }
  177. bool CHL1MPRules::ClientCommand( CBaseEntity *pEdict, const CCommand &args )
  178. {
  179. #ifndef CLIENT_DLL
  180. if( BaseClass::ClientCommand( pEdict, args ) )
  181. return true;
  182. CHL1MP_Player *pPlayer = (CHL1MP_Player *) pEdict;
  183. if ( pPlayer->ClientCommand( args ) )
  184. return true;
  185. #endif
  186. return false;
  187. }
  188. #ifdef CLIENT_DLL
  189. #else
  190. void CHL1MPRules::Think ( void )
  191. {
  192. CGameRules::Think();
  193. if ( g_fGameOver ) // someone else quit the game already
  194. {
  195. // check to see if we should change levels now
  196. if ( m_flIntermissionEndTime < gpGlobals->curtime )
  197. {
  198. ChangeLevel(); // intermission is over
  199. }
  200. return;
  201. }
  202. float flTimeLimit = mp_timelimit.GetFloat() * 60;
  203. float flFragLimit = fraglimit.GetFloat();
  204. if ( flTimeLimit != 0 && gpGlobals->curtime >= flTimeLimit )
  205. {
  206. GoToIntermission();
  207. return;
  208. }
  209. if ( flFragLimit )
  210. {
  211. if( IsTeamplay() == true )
  212. {
  213. for (int i = TEAM_SPECTATOR+1; i < GetNumberOfTeams(); i++)
  214. {
  215. if ( GetGlobalTeam(i)->GetScore() >= flFragLimit )
  216. {
  217. GoToIntermission();
  218. return;
  219. }
  220. }
  221. }
  222. else
  223. {
  224. // check if any player is over the frag limit
  225. for ( int i = 1; i <= gpGlobals->maxClients; i++ )
  226. {
  227. CBasePlayer *pPlayer = UTIL_PlayerByIndex( i );
  228. if ( pPlayer && pPlayer->FragCount() >= flFragLimit )
  229. {
  230. GoToIntermission();
  231. return;
  232. }
  233. }
  234. }
  235. }
  236. // ManageObjectRelocation();
  237. }
  238. void CHL1MPRules::GoToIntermission()
  239. {
  240. #ifndef CLIENT_DLL
  241. if ( g_fGameOver )
  242. return;
  243. g_fGameOver = true;
  244. m_flIntermissionEndTime = gpGlobals->curtime + mp_chattime.GetInt();
  245. for ( int i = 0; i < MAX_PLAYERS; i++ )
  246. {
  247. CBasePlayer *pPlayer = UTIL_PlayerByIndex( i );
  248. if ( !pPlayer )
  249. continue;
  250. pPlayer->ShowViewPortPanel( PANEL_SCOREBOARD );
  251. pPlayer->AddFlag( FL_FROZEN );
  252. }
  253. #endif
  254. }
  255. const char * CHL1MPRules::SetDefaultPlayerTeam( CBasePlayer *pPlayer )
  256. {
  257. if ( !IsTeamplay() )
  258. {
  259. CMultiplayRules::SetDefaultPlayerTeam( pPlayer );
  260. return "";
  261. }
  262. int clientIndex = pPlayer->entindex();
  263. char szTeam[128];
  264. Q_FileBase( engine->GetClientConVarValue( clientIndex, "cl_playermodel" ), szTeam, 128 );
  265. const char * team = szTeam;
  266. int iTeam = GetTeamIndex( team );
  267. if ( iTeam == -1 || !IsValidTeam( team ) )
  268. {
  269. team = TeamWithFewestPlayers();
  270. iTeam = GetTeamIndex(team);
  271. }
  272. pPlayer->ChangeTeam( iTeam );
  273. return team;
  274. }
  275. const char * CHL1MPRules::TeamWithFewestPlayers( void )
  276. {
  277. const char * szName = "";
  278. int iNumPlayers = 0xFFFF;
  279. for (int i = TEAM_SPECTATOR+1; i < GetNumberOfTeams(); i++)
  280. {
  281. if ( GetGlobalTeam(i)->GetNumPlayers() < iNumPlayers )
  282. {
  283. szName = GetGlobalTeam(i)->GetName();
  284. iNumPlayers = GetGlobalTeam(i)->GetNumPlayers();
  285. }
  286. }
  287. return szName;
  288. }
  289. void CHL1MPRules::InitHUD( CBasePlayer *pPlayer )
  290. {
  291. SetDefaultPlayerTeam( pPlayer );
  292. BaseClass::InitHUD( pPlayer );
  293. }
  294. void CHL1MPRules::ChangePlayerTeam( CBasePlayer *pPlayer, const char *pTeamName, bool bKill, bool bGib )
  295. {
  296. BaseClass::ChangePlayerTeam( pPlayer, pTeamName, bKill, bGib );
  297. }
  298. void CHL1MPRules::ClientSettingsChanged( CBasePlayer *pPlayer )
  299. {
  300. CHL1MP_Player *pHL1Player = ToHL1MPPlayer( pPlayer );
  301. if ( pHL1Player == NULL )
  302. return;
  303. // strip down to just the name
  304. char szTempCurrentModel[128];
  305. Q_FileBase( modelinfo->GetModelName( pPlayer->GetModel() ), szTempCurrentModel, 128 );
  306. const char *pCurrentModel = szTempCurrentModel;
  307. char szTempModelName[128];
  308. Q_FileBase( engine->GetClientConVarValue( engine->IndexOfEdict( pPlayer->edict() ), "cl_playermodel" ), szTempModelName, 128 );
  309. const char *szModelName = szTempModelName;
  310. //If we're different.
  311. if ( strlen( szModelName ) > 0 && stricmp( szModelName, pCurrentModel ) )
  312. {
  313. //Too soon, set the cvar back to what it was.
  314. //Note: this will make this function be called again
  315. //but since our models will match it'll just skip this whole dealio.
  316. if ( pHL1Player->GetNextModelChangeTime() >= gpGlobals->curtime )
  317. {
  318. char szReturnString[512];
  319. Q_snprintf( szReturnString, sizeof (szReturnString ), "cl_playermodel %s\n", pCurrentModel );
  320. engine->ClientCommand ( pHL1Player->edict(), szReturnString );
  321. Q_snprintf( szReturnString, sizeof( szReturnString ), "Please wait %d more seconds before trying to switch.\n", (int)(pHL1Player->GetNextModelChangeTime() - gpGlobals->curtime) );
  322. ClientPrint( pHL1Player, HUD_PRINTTALK, szReturnString );
  323. return;
  324. }
  325. if ( HL1MPRules()->IsTeamplay() == false )
  326. {
  327. pHL1Player->SetPlayerModel();
  328. //const char *pszCurrentModelName = modelinfo->GetModelName( pHL1Player->GetModel() );
  329. //char szReturnString[128];
  330. //Q_snprintf( szReturnString, sizeof( szReturnString ), "Your player model is: %s\n", pszCurrentModelName );
  331. //Printing the model path for the average player is way too verbose - ml
  332. //ClientPrint( pHL1Player, HUD_PRINTTALK, szReturnString );
  333. }
  334. else
  335. {
  336. int iTeam = GetTeamIndex( szModelName );
  337. if ( iTeam == -1 || !IsValidTeam( szModelName ) )
  338. {
  339. const char * team = TeamWithFewestPlayers();
  340. iTeam = GetTeamIndex( team );
  341. }
  342. pPlayer->ChangeTeam( iTeam );
  343. }
  344. }
  345. BaseClass::ClientSettingsChanged( pPlayer );
  346. }
  347. int CHL1MPRules::GetTeamIndex( const char * pName )
  348. {
  349. for ( int i = 0; i < GetNumberOfTeams(); i++ )
  350. {
  351. if ( strcmp( g_Teams[i]->GetName(), pName ) == 0 )
  352. {
  353. return i;
  354. }
  355. }
  356. return -1;
  357. }
  358. float CHL1MPRules::FlWeaponRespawnTime( CBaseCombatWeapon *pWeapon )
  359. {
  360. if ( weaponstay.GetInt() > 0 )
  361. {
  362. // make sure it's only certain weapons
  363. if ( !(pWeapon->GetWeaponFlags() & ITEM_FLAG_LIMITINWORLD) )
  364. {
  365. return 0;
  366. }
  367. }
  368. return sv_hl1mp_weapon_respawn_time.GetInt();
  369. }
  370. float CHL1MPRules::FlItemRespawnTime( CItem *pItem )
  371. {
  372. return sv_hl1mp_item_respawn_time.GetInt();
  373. }
  374. // This is a direct rip from CHalfLife1
  375. void CHL1MPRules::InitDefaultAIRelationships( void )
  376. {
  377. int i, j;
  378. // Allocate memory for default relationships
  379. CBaseCombatCharacter::AllocateDefaultRelationships();
  380. // --------------------------------------------------------------
  381. // First initialize table so we can report missing relationships
  382. // --------------------------------------------------------------
  383. for (i=0;i<NUM_AI_CLASSES;i++)
  384. {
  385. for (j=0;j<NUM_AI_CLASSES;j++)
  386. {
  387. // By default all relationships are neutral of priority zero
  388. CBaseCombatCharacter::SetDefaultRelationship( (Class_T)i, (Class_T)j, D_NU, 0 );
  389. }
  390. }
  391. // ------------------------------------------------------------
  392. // > CLASS_NONE
  393. // ------------------------------------------------------------
  394. CBaseCombatCharacter::SetDefaultRelationship( CLASS_NONE, CLASS_NONE, D_NU, 0 );
  395. CBaseCombatCharacter::SetDefaultRelationship( CLASS_NONE, CLASS_PLAYER, D_NU, 0 );
  396. CBaseCombatCharacter::SetDefaultRelationship( CLASS_NONE, CLASS_HUMAN_PASSIVE, D_NU, 0 );
  397. CBaseCombatCharacter::SetDefaultRelationship( CLASS_NONE, CLASS_PLAYER_ALLY, D_NU, 0 );
  398. CBaseCombatCharacter::SetDefaultRelationship( CLASS_NONE, CLASS_ALIEN_PREY, D_NU, 0 );
  399. CBaseCombatCharacter::SetDefaultRelationship( CLASS_NONE, CLASS_ALIEN_MILITARY, D_NU, 0 );
  400. CBaseCombatCharacter::SetDefaultRelationship( CLASS_NONE, CLASS_ALIEN_MONSTER, D_NU, 0 );
  401. CBaseCombatCharacter::SetDefaultRelationship( CLASS_NONE, CLASS_ALIEN_PREDATOR, D_NU, 0 );
  402. CBaseCombatCharacter::SetDefaultRelationship( CLASS_NONE, CLASS_HUMAN_MILITARY, D_NU, 0 );
  403. CBaseCombatCharacter::SetDefaultRelationship( CLASS_NONE, CLASS_MACHINE, D_NU, 0 );
  404. CBaseCombatCharacter::SetDefaultRelationship( CLASS_NONE, CLASS_ALIEN_BIOWEAPON, D_NU, 0 );
  405. CBaseCombatCharacter::SetDefaultRelationship( CLASS_NONE, CLASS_PLAYER_BIOWEAPON, D_NU, 0 );
  406. CBaseCombatCharacter::SetDefaultRelationship( CLASS_NONE, CLASS_INSECT, D_NU, 0 );
  407. // ------------------------------------------------------------
  408. // > CLASS_HUMAN_PASSIVE
  409. // ------------------------------------------------------------
  410. CBaseCombatCharacter::SetDefaultRelationship( CLASS_HUMAN_PASSIVE, CLASS_NONE, D_NU, 0 );
  411. CBaseCombatCharacter::SetDefaultRelationship( CLASS_HUMAN_PASSIVE, CLASS_PLAYER, D_LI, 0 );
  412. CBaseCombatCharacter::SetDefaultRelationship( CLASS_HUMAN_PASSIVE, CLASS_HUMAN_PASSIVE, D_LI, 0 );
  413. CBaseCombatCharacter::SetDefaultRelationship( CLASS_HUMAN_PASSIVE, CLASS_PLAYER_ALLY, D_LI, 0 );
  414. CBaseCombatCharacter::SetDefaultRelationship( CLASS_HUMAN_PASSIVE, CLASS_ALIEN_PREY, D_FR, 0 );
  415. CBaseCombatCharacter::SetDefaultRelationship( CLASS_HUMAN_PASSIVE, CLASS_ALIEN_MILITARY, D_FR, 0 );
  416. CBaseCombatCharacter::SetDefaultRelationship( CLASS_HUMAN_PASSIVE, CLASS_ALIEN_MONSTER, D_HT, 0 );
  417. CBaseCombatCharacter::SetDefaultRelationship( CLASS_HUMAN_PASSIVE, CLASS_ALIEN_PREDATOR, D_FR, 0 );
  418. CBaseCombatCharacter::SetDefaultRelationship( CLASS_HUMAN_PASSIVE, CLASS_HUMAN_MILITARY, D_HT, 0 );
  419. CBaseCombatCharacter::SetDefaultRelationship( CLASS_HUMAN_PASSIVE, CLASS_MACHINE, D_NU, 0 );
  420. CBaseCombatCharacter::SetDefaultRelationship( CLASS_HUMAN_PASSIVE, CLASS_ALIEN_BIOWEAPON, D_NU, 0 );
  421. CBaseCombatCharacter::SetDefaultRelationship( CLASS_HUMAN_PASSIVE, CLASS_PLAYER_BIOWEAPON, D_NU, 0 );
  422. CBaseCombatCharacter::SetDefaultRelationship( CLASS_HUMAN_PASSIVE, CLASS_INSECT, D_NU, 0 );
  423. // ------------------------------------------------------------
  424. // > CLASS_PLAYER
  425. // ------------------------------------------------------------
  426. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER, CLASS_NONE, D_NU, 0 );
  427. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER, CLASS_PLAYER, D_LI, 0 );
  428. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER, CLASS_HUMAN_PASSIVE, D_LI, 0 );
  429. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER, CLASS_PLAYER_ALLY, D_LI, 0 );
  430. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER, CLASS_ALIEN_PREY, D_HT, 0 );
  431. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER, CLASS_ALIEN_MILITARY, D_HT, 0 );
  432. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER, CLASS_ALIEN_MONSTER, D_HT, 0 );
  433. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER, CLASS_ALIEN_PREDATOR, D_HT, 0 );
  434. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER, CLASS_HUMAN_MILITARY, D_HT, 0 );
  435. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER, CLASS_MACHINE, D_HT, 0 );
  436. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER, CLASS_ALIEN_BIOWEAPON, D_HT, 0 );
  437. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER, CLASS_PLAYER_BIOWEAPON, D_HT, 0 );
  438. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER, CLASS_INSECT, D_NU, 0 );
  439. // ------------------------------------------------------------
  440. // > CLASS_PLAYER_ALLY
  441. // ------------------------------------------------------------
  442. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER_ALLY, CLASS_NONE, D_NU, 0 );
  443. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER_ALLY, CLASS_PLAYER, D_LI, 0 );
  444. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER_ALLY, CLASS_HUMAN_PASSIVE, D_LI, 0 );
  445. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER_ALLY, CLASS_PLAYER_ALLY, D_LI, 0 );
  446. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER_ALLY, CLASS_ALIEN_PREY, D_HT, 0 );
  447. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER_ALLY, CLASS_ALIEN_MILITARY, D_HT, 0 );
  448. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER_ALLY, CLASS_ALIEN_MONSTER, D_HT, 0 );
  449. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER_ALLY, CLASS_ALIEN_PREDATOR, D_HT, 0 );
  450. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER_ALLY, CLASS_HUMAN_MILITARY, D_HT, 0 );
  451. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER_ALLY, CLASS_MACHINE, D_HT, 0 );
  452. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER_ALLY, CLASS_ALIEN_BIOWEAPON, D_NU, 0 );
  453. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER_ALLY, CLASS_PLAYER_BIOWEAPON, D_NU, 0 );
  454. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER_ALLY, CLASS_INSECT, D_NU, 0 );
  455. // ------------------------------------------------------------
  456. // > CLASS_ALIEN_PREY
  457. // ------------------------------------------------------------
  458. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_PREY, CLASS_NONE, D_NU, 0 );
  459. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_PREY, CLASS_PLAYER, D_HT, 0 );
  460. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_PREY, CLASS_PLAYER_ALLY, D_HT, 0 );
  461. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_PREY, CLASS_HUMAN_PASSIVE, D_HT, 0 );
  462. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_PREY, CLASS_ALIEN_PREY, D_NU, 0 );
  463. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_PREY, CLASS_ALIEN_MILITARY, D_NU, 0 );
  464. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_PREY, CLASS_ALIEN_MONSTER, D_NU, 0 );
  465. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_PREY, CLASS_ALIEN_PREDATOR, D_FR, 0 );
  466. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_PREY, CLASS_HUMAN_MILITARY, D_HT, 0 );
  467. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_PREY, CLASS_MACHINE, D_NU, 0 );
  468. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_PREY, CLASS_ALIEN_BIOWEAPON, D_NU, 0 );
  469. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_PREY, CLASS_PLAYER_BIOWEAPON, D_NU, 0 );
  470. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_PREY, CLASS_INSECT, D_NU, 0 );
  471. // ------------------------------------------------------------
  472. // > CLASS_ALIEN_MILITARY
  473. // ------------------------------------------------------------
  474. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_MILITARY, CLASS_NONE, D_NU, 0 );
  475. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_MILITARY, CLASS_PLAYER, D_HT, 0 );
  476. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_MILITARY, CLASS_PLAYER_ALLY, D_HT, 0 );
  477. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_MILITARY, CLASS_HUMAN_PASSIVE, D_HT, 0 );
  478. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_MILITARY, CLASS_ALIEN_PREY, D_NU, 0 );
  479. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_MILITARY, CLASS_ALIEN_MILITARY, D_NU, 0 );
  480. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_MILITARY, CLASS_ALIEN_MONSTER, D_NU, 0 );
  481. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_MILITARY, CLASS_ALIEN_PREDATOR, D_NU, 0 );
  482. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_MILITARY, CLASS_HUMAN_MILITARY, D_HT, 0 );
  483. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_MILITARY, CLASS_MACHINE, D_HT, 0 );
  484. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_MILITARY, CLASS_ALIEN_BIOWEAPON, D_NU, 0 );
  485. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_MILITARY, CLASS_PLAYER_BIOWEAPON, D_NU, 0 );
  486. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_MILITARY, CLASS_INSECT, D_NU, 0 );
  487. // ------------------------------------------------------------
  488. // > CLASS_ALIEN_MONSTER
  489. // ------------------------------------------------------------
  490. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_MONSTER, CLASS_NONE, D_NU, 0 );
  491. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_MONSTER, CLASS_PLAYER, D_HT, 0 );
  492. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_MONSTER, CLASS_PLAYER_ALLY, D_HT, 0 );
  493. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_MONSTER, CLASS_HUMAN_PASSIVE, D_HT, 0 );
  494. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_MONSTER, CLASS_ALIEN_PREY, D_NU, 0 );
  495. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_MONSTER, CLASS_ALIEN_MILITARY, D_NU, 0 );
  496. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_MONSTER, CLASS_ALIEN_MONSTER, D_NU, 0 );
  497. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_MONSTER, CLASS_ALIEN_PREDATOR, D_NU, 0 );
  498. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_MONSTER, CLASS_HUMAN_MILITARY, D_HT, 0 );
  499. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_MONSTER, CLASS_MACHINE, D_HT, 0 );
  500. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_MONSTER, CLASS_ALIEN_BIOWEAPON, D_NU, 0 );
  501. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_MONSTER, CLASS_PLAYER_BIOWEAPON, D_NU, 0 );
  502. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_MONSTER, CLASS_INSECT, D_NU, 0 );
  503. // ------------------------------------------------------------
  504. // > CLASS_ALIEN_PREDATOR
  505. // ------------------------------------------------------------
  506. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_PREDATOR, CLASS_NONE, D_NU, 0 );
  507. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_PREDATOR, CLASS_PLAYER, D_HT, 0 );
  508. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_PREDATOR, CLASS_PLAYER_ALLY, D_HT, 0 );
  509. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_PREDATOR, CLASS_HUMAN_PASSIVE, D_HT, 0 );
  510. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_PREDATOR, CLASS_ALIEN_PREY, D_HT, 0 );
  511. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_PREDATOR, CLASS_ALIEN_MILITARY, D_NU, 0 );
  512. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_PREDATOR, CLASS_ALIEN_MONSTER, D_NU, 0 );
  513. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_PREDATOR, CLASS_ALIEN_PREDATOR, D_NU, 0 );
  514. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_PREDATOR, CLASS_HUMAN_MILITARY, D_HT, 0 );
  515. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_PREDATOR, CLASS_MACHINE, D_NU, 0 );
  516. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_PREDATOR, CLASS_ALIEN_BIOWEAPON, D_NU, 0 );
  517. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_PREDATOR, CLASS_PLAYER_BIOWEAPON, D_NU, 0 );
  518. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_PREDATOR, CLASS_INSECT, D_NU, 0 );
  519. // ------------------------------------------------------------
  520. // > CLASS_HUMAN_MILITARY
  521. // ------------------------------------------------------------
  522. CBaseCombatCharacter::SetDefaultRelationship( CLASS_HUMAN_MILITARY, CLASS_NONE, D_NU, 0 );
  523. CBaseCombatCharacter::SetDefaultRelationship( CLASS_HUMAN_MILITARY, CLASS_PLAYER, D_HT, 0 );
  524. CBaseCombatCharacter::SetDefaultRelationship( CLASS_HUMAN_MILITARY, CLASS_PLAYER_ALLY, D_HT, 0 );
  525. CBaseCombatCharacter::SetDefaultRelationship( CLASS_HUMAN_MILITARY, CLASS_HUMAN_PASSIVE, D_HT, 0 );
  526. CBaseCombatCharacter::SetDefaultRelationship( CLASS_HUMAN_MILITARY, CLASS_ALIEN_PREY, D_HT, 0 );
  527. CBaseCombatCharacter::SetDefaultRelationship( CLASS_HUMAN_MILITARY, CLASS_ALIEN_MILITARY, D_HT, 0 );
  528. CBaseCombatCharacter::SetDefaultRelationship( CLASS_HUMAN_MILITARY, CLASS_ALIEN_MONSTER, D_HT, 0 );
  529. CBaseCombatCharacter::SetDefaultRelationship( CLASS_HUMAN_MILITARY, CLASS_ALIEN_PREDATOR, D_HT, 0 );
  530. CBaseCombatCharacter::SetDefaultRelationship( CLASS_HUMAN_MILITARY, CLASS_HUMAN_MILITARY, D_NU, 0 );
  531. CBaseCombatCharacter::SetDefaultRelationship( CLASS_HUMAN_MILITARY, CLASS_MACHINE, D_NU, 0 );
  532. CBaseCombatCharacter::SetDefaultRelationship( CLASS_HUMAN_MILITARY, CLASS_ALIEN_BIOWEAPON, D_NU, 0 );
  533. CBaseCombatCharacter::SetDefaultRelationship( CLASS_HUMAN_MILITARY, CLASS_PLAYER_BIOWEAPON, D_NU, 0 );
  534. CBaseCombatCharacter::SetDefaultRelationship( CLASS_HUMAN_MILITARY, CLASS_INSECT, D_NU, 0 );
  535. // ------------------------------------------------------------
  536. // > CLASS_MACHINE
  537. // ------------------------------------------------------------
  538. CBaseCombatCharacter::SetDefaultRelationship( CLASS_MACHINE, CLASS_NONE, D_NU, 0 );
  539. CBaseCombatCharacter::SetDefaultRelationship( CLASS_MACHINE, CLASS_MACHINE, D_NU, 0 );
  540. CBaseCombatCharacter::SetDefaultRelationship( CLASS_MACHINE, CLASS_PLAYER, D_HT, 0 );
  541. CBaseCombatCharacter::SetDefaultRelationship( CLASS_MACHINE, CLASS_HUMAN_PASSIVE, D_HT, 0 );
  542. CBaseCombatCharacter::SetDefaultRelationship( CLASS_MACHINE, CLASS_HUMAN_MILITARY, D_NU, 0 );
  543. CBaseCombatCharacter::SetDefaultRelationship( CLASS_MACHINE, CLASS_ALIEN_MILITARY, D_HT, 0 );
  544. CBaseCombatCharacter::SetDefaultRelationship( CLASS_MACHINE, CLASS_ALIEN_MONSTER, D_HT, 0 );
  545. CBaseCombatCharacter::SetDefaultRelationship( CLASS_MACHINE, CLASS_ALIEN_PREY, D_HT, 0 );
  546. CBaseCombatCharacter::SetDefaultRelationship( CLASS_MACHINE, CLASS_ALIEN_PREDATOR, D_HT, 0 );
  547. CBaseCombatCharacter::SetDefaultRelationship( CLASS_MACHINE, CLASS_PLAYER_ALLY, D_HT, 0 );
  548. CBaseCombatCharacter::SetDefaultRelationship( CLASS_MACHINE, CLASS_ALIEN_BIOWEAPON, D_HT, 0 );
  549. CBaseCombatCharacter::SetDefaultRelationship( CLASS_MACHINE, CLASS_PLAYER_BIOWEAPON, D_HT, 0 );
  550. CBaseCombatCharacter::SetDefaultRelationship( CLASS_MACHINE, CLASS_INSECT, D_NU, 0 );
  551. // ------------------------------------------------------------
  552. // > CLASS_ALIEN_BIOWEAPON
  553. // ------------------------------------------------------------
  554. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_BIOWEAPON, CLASS_NONE, D_NU, 0 );
  555. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_BIOWEAPON, CLASS_MACHINE, D_NU, 0 );
  556. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_BIOWEAPON, CLASS_PLAYER, D_HT, 0 );
  557. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_BIOWEAPON, CLASS_HUMAN_PASSIVE, D_HT, 0 );
  558. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_BIOWEAPON, CLASS_HUMAN_MILITARY, D_HT, 0 );
  559. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_BIOWEAPON, CLASS_ALIEN_MILITARY, D_LI, 0 );
  560. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_BIOWEAPON, CLASS_ALIEN_MONSTER, D_HT, 0 );
  561. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_BIOWEAPON, CLASS_ALIEN_PREY, D_HT, 0 );
  562. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_BIOWEAPON, CLASS_ALIEN_PREDATOR, D_NU, 0 );
  563. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_BIOWEAPON, CLASS_PLAYER_ALLY, D_HT, 0 );
  564. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_BIOWEAPON, CLASS_ALIEN_BIOWEAPON, D_NU, 0 );
  565. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_BIOWEAPON, CLASS_PLAYER_BIOWEAPON, D_HT, 0 );
  566. CBaseCombatCharacter::SetDefaultRelationship( CLASS_ALIEN_BIOWEAPON, CLASS_INSECT, D_NU, 0 );
  567. // ------------------------------------------------------------
  568. // > CLASS_PLAYER_BIOWEAPON
  569. // ------------------------------------------------------------
  570. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER_BIOWEAPON, CLASS_NONE, D_NU, 0 );
  571. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER_BIOWEAPON, CLASS_MACHINE, D_NU, 0 );
  572. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER_BIOWEAPON, CLASS_PLAYER, D_HT, 0 );
  573. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER_BIOWEAPON, CLASS_HUMAN_PASSIVE, D_HT, 0 );
  574. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER_BIOWEAPON, CLASS_HUMAN_MILITARY, D_HT, 0 );
  575. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER_BIOWEAPON, CLASS_ALIEN_MILITARY, D_HT, 0 );
  576. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER_BIOWEAPON, CLASS_ALIEN_MONSTER, D_HT, 0 );
  577. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER_BIOWEAPON, CLASS_ALIEN_PREY, D_HT, 0 );
  578. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER_BIOWEAPON, CLASS_ALIEN_PREDATOR, D_HT, 0 );
  579. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER_BIOWEAPON, CLASS_PLAYER_ALLY, D_HT, 0 );
  580. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER_BIOWEAPON, CLASS_ALIEN_BIOWEAPON, D_HT, 0 );
  581. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER_BIOWEAPON, CLASS_PLAYER_BIOWEAPON, D_NU, 0 );
  582. CBaseCombatCharacter::SetDefaultRelationship( CLASS_PLAYER_BIOWEAPON, CLASS_INSECT, D_NU, 0 );
  583. // ------------------------------------------------------------
  584. // > CLASS_INSECT
  585. // ------------------------------------------------------------
  586. CBaseCombatCharacter::SetDefaultRelationship( CLASS_INSECT, CLASS_NONE, D_FR, 0 );
  587. CBaseCombatCharacter::SetDefaultRelationship( CLASS_INSECT, CLASS_MACHINE, D_FR, 0 );
  588. CBaseCombatCharacter::SetDefaultRelationship( CLASS_INSECT, CLASS_PLAYER, D_FR, 0 );
  589. CBaseCombatCharacter::SetDefaultRelationship( CLASS_INSECT, CLASS_HUMAN_PASSIVE, D_FR, 0 );
  590. CBaseCombatCharacter::SetDefaultRelationship( CLASS_INSECT, CLASS_HUMAN_MILITARY, D_FR, 0 );
  591. CBaseCombatCharacter::SetDefaultRelationship( CLASS_INSECT, CLASS_ALIEN_MILITARY, D_NU, 0 );
  592. CBaseCombatCharacter::SetDefaultRelationship( CLASS_INSECT, CLASS_ALIEN_MONSTER, D_FR, 0 );
  593. CBaseCombatCharacter::SetDefaultRelationship( CLASS_INSECT, CLASS_ALIEN_PREY, D_FR, 0 );
  594. CBaseCombatCharacter::SetDefaultRelationship( CLASS_INSECT, CLASS_ALIEN_PREDATOR, D_FR, 0 );
  595. CBaseCombatCharacter::SetDefaultRelationship( CLASS_INSECT, CLASS_PLAYER_ALLY, D_FR, 0 );
  596. CBaseCombatCharacter::SetDefaultRelationship( CLASS_INSECT, CLASS_ALIEN_BIOWEAPON, D_NU, 0 );
  597. CBaseCombatCharacter::SetDefaultRelationship( CLASS_INSECT, CLASS_PLAYER_BIOWEAPON, D_NU, 0 );
  598. CBaseCombatCharacter::SetDefaultRelationship( CLASS_INSECT, CLASS_INSECT, D_NU, 0 );
  599. }
  600. #endif