upload "kind" alien swarm

This commit is contained in:
nillerusr
2023-10-03 17:23:56 +03:00
parent b7bd94c52e
commit 7d3c0d8b5a
4229 changed files with 462900 additions and 495155 deletions
+57 -74
View File
@@ -1,4 +1,4 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============
//
// Purpose:
//
@@ -8,9 +8,13 @@
#include "cbase.h"
#include "mp_shareddefs.h"
#include "basemultiplayerplayer.h"
#include "cdll_int.h"
#include "gameinterface.h"
// Minimum interval between rate-limited commands that players can run.
#define COMMAND_MAX_RATE 0.3
ConVar sv_allchat("sv_allchat", "1", FCVAR_NOTIFY, "Players can receive all other players' text chat, no death restrictions");
// NOTE: This has to be the last file included!
#include "tier0/memdbgon.h"
CBaseMultiplayerPlayer::CBaseMultiplayerPlayer()
{
@@ -18,6 +22,7 @@ CBaseMultiplayerPlayer::CBaseMultiplayerPlayer()
m_flLastForcedChangeTeamTime = -1;
m_iBalanceScore = 0;
m_flConnectionTime = gpGlobals->curtime;
m_pExpresser = NULL;
// per life achievement counters
m_pAchievementKV = new KeyValues( "achievement_counts" );
@@ -28,6 +33,7 @@ CBaseMultiplayerPlayer::CBaseMultiplayerPlayer()
CBaseMultiplayerPlayer::~CBaseMultiplayerPlayer()
{
m_pAchievementKV->deleteThis();
delete m_pExpresser;
}
//-----------------------------------------------------------------------------
@@ -65,7 +71,7 @@ void CBaseMultiplayerPlayer::ModifyOrAppendCriteria( AI_CriteriaSet& criteriaSet
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CBaseMultiplayerPlayer::SpeakIfAllowed( AIConcept_t concept, const char *modifiers, char *pszOutResponseChosen, size_t bufsize, IRecipientFilter *filter )
bool CBaseMultiplayerPlayer::SpeakIfAllowed( AIConcept_t concept, SpeechPriorityType priority, const char *modifiers, char *pszOutResponseChosen, size_t bufsize, IRecipientFilter *filter )
{
if ( !IsAlive() )
return false;
@@ -75,24 +81,16 @@ bool CBaseMultiplayerPlayer::SpeakIfAllowed( AIConcept_t concept, const char *mo
}
//-----------------------------------------------------------------------------
// Purpose:
// Purpose: Fill out given response with the appropriate one for this concept
//-----------------------------------------------------------------------------
IResponseSystem *CBaseMultiplayerPlayer::GetResponseSystem()
{
return BaseClass::GetResponseSystem();
// NOTE: This is where you would hook your custom responses.
// return <*>GameRules()->m_ResponseRules[iIndex].m_ResponseSystems[m_iCurrentConcept];
}
//-----------------------------------------------------------------------------
// Purpose: Doesn't actually speak the concept. Just finds a response in the system. You then have to play it yourself.
//-----------------------------------------------------------------------------
AI_Response *CBaseMultiplayerPlayer::SpeakConcept( int iConcept )
void CBaseMultiplayerPlayer::SpeakConcept( AI_Response &outResponse, int iConcept )
{
m_iCurrentConcept = iConcept;
return SpeakFindResponse( g_pszMPConcepts[iConcept] );
AIConcept_t concept( g_pszMPConcepts[iConcept] );
FindResponse( outResponse, concept );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
@@ -100,7 +98,7 @@ bool CBaseMultiplayerPlayer::SpeakConceptIfAllowed( int iConcept, const char *mo
{
// Save the current concept.
m_iCurrentConcept = iConcept;
return SpeakIfAllowed( g_pszMPConcepts[iConcept], modifiers, pszOutResponseChosen, bufsize, filter );
return SpeakIfAllowed( g_pszMPConcepts[iConcept], SPEECH_PRIORITY_NORMAL, modifiers, pszOutResponseChosen, bufsize, filter );
}
//-----------------------------------------------------------------------------
@@ -127,65 +125,26 @@ bool CBaseMultiplayerPlayer::CanHearAndReadChatFrom( CBasePlayer *pPlayer )
return true;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CBaseMultiplayerPlayer::ShouldRunRateLimitedCommand( const CCommand &args )
{
return ShouldRunRateLimitedCommand( args[0] );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CBaseMultiplayerPlayer::ShouldRunRateLimitedCommand( const char *pszCommand )
{
const char *pcmd = pszCommand;
int i = m_RateLimitLastCommandTimes.Find( pcmd );
if ( i == m_RateLimitLastCommandTimes.InvalidIndex() )
{
m_RateLimitLastCommandTimes.Insert( pcmd, gpGlobals->curtime );
return true;
}
else if ( (gpGlobals->curtime - m_RateLimitLastCommandTimes[i]) < COMMAND_MAX_RATE )
{
// Too fast.
return false;
}
else
{
m_RateLimitLastCommandTimes[i] = gpGlobals->curtime;
return true;
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CBaseMultiplayerPlayer::ClientCommand( const CCommand &args )
{
const char *pcmd = args[0];
if ( FStrEq( pcmd, "ignoremsg" ) )
{
if ( ShouldRunRateLimitedCommand( args ) )
m_iIgnoreGlobalChat = (m_iIgnoreGlobalChat + 1) % 3;
switch( m_iIgnoreGlobalChat )
{
m_iIgnoreGlobalChat = (m_iIgnoreGlobalChat + 1) % 3;
switch( m_iIgnoreGlobalChat )
{
case CHAT_IGNORE_NONE:
ClientPrint( this, HUD_PRINTTALK, "#Accept_All_Messages" );
break;
case CHAT_IGNORE_ALL:
ClientPrint( this, HUD_PRINTTALK, "#Ignore_Broadcast_Messages" );
break;
case CHAT_IGNORE_TEAM:
ClientPrint( this, HUD_PRINTTALK, "#Ignore_Broadcast_Team_Messages" );
break;
default:
break;
}
case CHAT_IGNORE_NONE:
ClientPrint( this, HUD_PRINTTALK, "#Accept_All_Messages" );
break;
case CHAT_IGNORE_ALL:
ClientPrint( this, HUD_PRINTTALK, "#Ignore_Broadcast_Messages" );
break;
case CHAT_IGNORE_TEAM:
ClientPrint( this, HUD_PRINTTALK, "#Ignore_Broadcast_Team_Messages" );
break;
default:
break;
}
return true;
}
@@ -220,12 +179,10 @@ void CBaseMultiplayerPlayer::Spawn( void )
{
ResetPerLifeCounters();
StopScoringEscortPoints();
BaseClass::Spawn();
}
void CBaseMultiplayerPlayer::AwardAchievement( int iAchievement, int iCount )
void CBaseMultiplayerPlayer::AwardAchievement( int iAchievement )
{
Assert( iAchievement >= 0 && iAchievement < 0xFFFF ); // must fit in short
@@ -233,7 +190,6 @@ void CBaseMultiplayerPlayer::AwardAchievement( int iAchievement, int iCount )
UserMessageBegin( filter, "AchievementEvent" );
WRITE_SHORT( iAchievement );
WRITE_SHORT( iCount );
MessageEnd();
}
@@ -347,3 +303,30 @@ void CBaseMultiplayerPlayer::StopScoringEscortPoints( void )
SetContextThink( NULL, 0, ESCORT_SCORE_CONTEXT );
}
#if !defined(NO_STEAM)
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CBaseMultiplayerPlayer::GetSteamID( CSteamID *pID )
{
const CSteamID *pClientID = engine->GetClientSteamID( edict() );
if ( pClientID )
{
*pID = *pClientID;
return true;
}
return false;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
uint64 CBaseMultiplayerPlayer::GetSteamIDAsUInt64( void )
{
CSteamID steamIDForPlayer;
if ( GetSteamID( &steamIDForPlayer ) )
return steamIDForPlayer.ConvertToUint64();
return 0;
}
#endif // NO_STEAM