mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-08 01:39:36 +00:00
Merge branch 'master' into windows
This commit is contained in:
+66
-51
@@ -27,8 +27,13 @@ AI_CriteriaSet::AI_CriteriaSet() : m_Lookup( 0, 0, CritEntry_t::LessFunc )
|
||||
//-----------------------------------------------------------------------------
|
||||
AI_CriteriaSet::AI_CriteriaSet( const AI_CriteriaSet& src ) : m_Lookup( 0, 0, CritEntry_t::LessFunc )
|
||||
{
|
||||
// Use fast Copy CUtlRBTree CopyFrom. WARNING: It only handles POD.
|
||||
m_Lookup.CopyFrom( src.m_Lookup );
|
||||
m_Lookup.Purge();
|
||||
for ( short i = src.m_Lookup.FirstInorder();
|
||||
i != src.m_Lookup.InvalidIndex();
|
||||
i = src.m_Lookup.NextInorder( i ) )
|
||||
{
|
||||
m_Lookup.Insert( src.m_Lookup[ i ] );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -157,6 +162,7 @@ void AI_CriteriaSet::Describe()
|
||||
{
|
||||
for ( short i = m_Lookup.FirstInorder(); i != m_Lookup.InvalidIndex(); i = m_Lookup.NextInorder( i ) )
|
||||
{
|
||||
|
||||
CritEntry_t *entry = &m_Lookup[ i ];
|
||||
|
||||
if ( entry->weight != 1.0f )
|
||||
@@ -193,9 +199,9 @@ AI_Response::AI_Response()
|
||||
{
|
||||
m_Type = RESPONSE_NONE;
|
||||
m_szResponseName[0] = 0;
|
||||
m_szMatchingRule[0] = 0;
|
||||
|
||||
m_pCriteria = NULL;
|
||||
m_szMatchingRule[0]=0;
|
||||
m_szContext = NULL;
|
||||
m_bApplyContextToWorld = false;
|
||||
}
|
||||
|
||||
@@ -203,8 +209,13 @@ AI_Response::AI_Response()
|
||||
//-----------------------------------------------------------------------------
|
||||
AI_Response::AI_Response( const AI_Response &from )
|
||||
{
|
||||
Assert( (void*)(&m_Type) == (void*)this );
|
||||
m_pCriteria = NULL;
|
||||
*this = from;
|
||||
memcpy( this, &from, sizeof(*this) );
|
||||
m_pCriteria = NULL;
|
||||
m_szContext = NULL;
|
||||
SetContext( from.m_szContext );
|
||||
m_bApplyContextToWorld = from.m_bApplyContextToWorld;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -213,34 +224,20 @@ AI_Response::AI_Response( const AI_Response &from )
|
||||
AI_Response::~AI_Response()
|
||||
{
|
||||
delete m_pCriteria;
|
||||
m_pCriteria = NULL;
|
||||
delete[] m_szContext;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
AI_Response &AI_Response::operator=( const AI_Response &from )
|
||||
{
|
||||
Assert( (void*)(&m_Type) == (void*)this );
|
||||
|
||||
if (this == &from)
|
||||
return *this;
|
||||
|
||||
m_Type = from.m_Type;
|
||||
|
||||
V_strcpy_safe( m_szResponseName, from.m_szResponseName );
|
||||
V_strcpy_safe( m_szMatchingRule, from.m_szMatchingRule );
|
||||
|
||||
delete m_pCriteria;
|
||||
m_pCriteria = NULL;
|
||||
|
||||
// Copy criteria.
|
||||
if (from.m_pCriteria)
|
||||
m_pCriteria = new AI_CriteriaSet(*from.m_pCriteria);
|
||||
|
||||
m_Params = from.m_Params;
|
||||
|
||||
m_szContext = from.m_szContext;
|
||||
memcpy( this, &from, sizeof(*this) );
|
||||
m_pCriteria = NULL;
|
||||
m_szContext = NULL;
|
||||
SetContext( from.m_szContext );
|
||||
m_bApplyContextToWorld = from.m_bApplyContextToWorld;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -249,22 +246,15 @@ AI_Response &AI_Response::operator=( const AI_Response &from )
|
||||
// Input : *response -
|
||||
// *criteria -
|
||||
//-----------------------------------------------------------------------------
|
||||
void AI_Response::Init( ResponseType_t type, const char *responseName, const AI_CriteriaSet& criteria,
|
||||
const AI_ResponseParams& responseparams, const char *ruleName, const char *applyContext,
|
||||
bool bApplyContextToWorld )
|
||||
void AI_Response::Init( ResponseType_t type, const char *responseName, const AI_CriteriaSet& criteria, const AI_ResponseParams& responseparams, const char *ruleName, const char *applyContext, bool bApplyContextToWorld )
|
||||
{
|
||||
m_Type = type;
|
||||
|
||||
V_strcpy_safe( m_szResponseName, responseName );
|
||||
V_strcpy_safe( m_szMatchingRule, ruleName ? ruleName : "NULL" );
|
||||
|
||||
Q_strncpy( m_szResponseName, responseName, sizeof( m_szResponseName ) );
|
||||
// Copy underlying criteria
|
||||
Assert( !m_pCriteria );
|
||||
m_pCriteria = new AI_CriteriaSet( criteria );
|
||||
|
||||
Q_strncpy( m_szMatchingRule, ruleName ? ruleName : "NULL", sizeof( m_szMatchingRule ) );
|
||||
m_Params = responseparams;
|
||||
|
||||
m_szContext = applyContext;
|
||||
SetContext( applyContext );
|
||||
m_bApplyContextToWorld = bApplyContextToWorld;
|
||||
}
|
||||
|
||||
@@ -279,29 +269,35 @@ void AI_Response::Describe()
|
||||
m_pCriteria->Describe();
|
||||
}
|
||||
if ( m_szMatchingRule[ 0 ] )
|
||||
{
|
||||
DevMsg( "Matched rule '%s', ", m_szMatchingRule );
|
||||
if ( m_szContext.Length() )
|
||||
DevMsg( "Contexts to set '%s' on %s, ", m_szContext.Get(), m_bApplyContextToWorld ? "world" : "speaker" );
|
||||
}
|
||||
if ( m_szContext )
|
||||
{
|
||||
DevMsg( "Contexts to set '%s' on %s, ", m_szContext, m_bApplyContextToWorld ? "world" : "speaker" );
|
||||
}
|
||||
|
||||
DevMsg( "response %s = '%s'\n", DescribeResponse( (ResponseType_t)m_Type ), m_szResponseName );
|
||||
DevMsg( "response %s = '%s'\n", DescribeResponse( (ResponseType_t)m_Type ), m_szResponseName );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Output : char const
|
||||
//-----------------------------------------------------------------------------
|
||||
const char * AI_Response::GetNamePtr() const
|
||||
void AI_Response::GetName( char *buf, size_t buflen ) const
|
||||
{
|
||||
return m_szResponseName;
|
||||
Q_strncpy( buf, m_szResponseName, buflen );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Output : char const
|
||||
//-----------------------------------------------------------------------------
|
||||
const char * AI_Response::GetResponsePtr() const
|
||||
void AI_Response::GetResponse( char *buf, size_t buflen ) const
|
||||
{
|
||||
return m_szResponseName;
|
||||
GetName( buf, buflen );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Input : type -
|
||||
@@ -317,15 +313,25 @@ const char *AI_Response::DescribeResponse( ResponseType_t type )
|
||||
|
||||
switch( type )
|
||||
{
|
||||
case RESPONSE_NONE: return "RESPONSE_NONE";
|
||||
case RESPONSE_SPEAK: return "RESPONSE_SPEAK";
|
||||
case RESPONSE_SENTENCE: return "RESPONSE_SENTENCE";
|
||||
case RESPONSE_SCENE: return "RESPONSE_SCENE";
|
||||
case RESPONSE_RESPONSE: return "RESPONSE_RESPONSE";
|
||||
case RESPONSE_PRINT: return "RESPONSE_PRINT";
|
||||
default:
|
||||
{
|
||||
Assert( 0 );
|
||||
}
|
||||
// Fall through
|
||||
case RESPONSE_NONE:
|
||||
return "RESPONSE_NONE";
|
||||
case RESPONSE_SPEAK:
|
||||
return "RESPONSE_SPEAK";
|
||||
case RESPONSE_SENTENCE:
|
||||
return "RESPONSE_SENTENCE";
|
||||
case RESPONSE_SCENE:
|
||||
return "RESPONSE_SCENE";
|
||||
case RESPONSE_RESPONSE:
|
||||
return "RESPONSE_RESPONSE";
|
||||
case RESPONSE_PRINT:
|
||||
return "RESPONSE_PRINT";
|
||||
}
|
||||
|
||||
Assert( 0 );
|
||||
return "RESPONSE_NONE";
|
||||
}
|
||||
|
||||
@@ -441,7 +447,16 @@ float AI_Response::GetPreDelay() const
|
||||
//-----------------------------------------------------------------------------
|
||||
void AI_Response::SetContext( const char *context )
|
||||
{
|
||||
m_szContext = context;
|
||||
delete[] m_szContext;
|
||||
m_szContext = NULL;
|
||||
|
||||
if ( context )
|
||||
{
|
||||
int len = Q_strlen( context );
|
||||
m_szContext = new char[ len + 1 ];
|
||||
Q_memcpy( m_szContext, context, len );
|
||||
m_szContext[ len ] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -84,10 +84,8 @@ private:
|
||||
Q_strncpy( value, str, sizeof( value ) );
|
||||
}
|
||||
}
|
||||
|
||||
// We use CUtlRBTree CopyFrom() in ctor, so CritEntry_t must be POD. If you add
|
||||
// CUtlString or something then you must change AI_CriteriaSet copy ctor.
|
||||
CUtlSymbol criterianame;
|
||||
|
||||
CUtlSymbol criterianame;
|
||||
char value[ 64 ];
|
||||
float weight;
|
||||
};
|
||||
@@ -95,7 +93,7 @@ private:
|
||||
CUtlRBTree< CritEntry_t, short > m_Lookup;
|
||||
};
|
||||
|
||||
#pragma pack(1)
|
||||
//#pragma pack(1)
|
||||
template<typename T>
|
||||
struct response_interval_t
|
||||
{
|
||||
@@ -152,7 +150,7 @@ struct AI_ResponseParams
|
||||
|
||||
responseparams_interval_t predelay; //21
|
||||
};
|
||||
#pragma pack()
|
||||
//#pragma pack()
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Generic container for a response to a match to a criteria set
|
||||
@@ -180,10 +178,10 @@ public:
|
||||
~AI_Response();
|
||||
AI_Response &operator=( const AI_Response &from );
|
||||
|
||||
void Release();
|
||||
void Release();
|
||||
|
||||
const char * GetNamePtr() const;
|
||||
const char * GetResponsePtr() const;
|
||||
void GetName( char *buf, size_t buflen ) const;
|
||||
void GetResponse( char *buf, size_t buflen ) const;
|
||||
const AI_ResponseParams *GetParams() const { return &m_Params; }
|
||||
ResponseType_t GetType() const { return (ResponseType_t)m_Type; }
|
||||
soundlevel_t GetSoundLevel() const;
|
||||
@@ -197,7 +195,7 @@ public:
|
||||
float GetPreDelay() const;
|
||||
|
||||
void SetContext( const char *context );
|
||||
const char * GetContext( void ) const { return m_szContext.Length() ? m_szContext.Get() : NULL; }
|
||||
const char * GetContext( void ) const { return m_szContext; }
|
||||
|
||||
bool IsApplyContextToWorld( void ) { return m_bApplyContextToWorld; }
|
||||
|
||||
@@ -232,7 +230,7 @@ private:
|
||||
|
||||
AI_ResponseParams m_Params;
|
||||
|
||||
CUtlString m_szContext;
|
||||
char * m_szContext;
|
||||
bool m_bApplyContextToWorld;
|
||||
};
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ inline static char *CopyString( const char *in )
|
||||
return out;
|
||||
}
|
||||
|
||||
#pragma pack(1)
|
||||
class Matcher
|
||||
{
|
||||
public:
|
||||
@@ -542,7 +541,6 @@ struct Rule
|
||||
bool m_bMatchOnce : 1;
|
||||
bool m_bEnabled : 1;
|
||||
};
|
||||
#pragma pack()
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
abstract_class IResponseFilter
|
||||
{
|
||||
public:
|
||||
virtual ~IResponseFilter(){}
|
||||
virtual bool IsValidResponse( ResponseType_t type, const char *pszValue ) = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -925,25 +925,6 @@ void CBaseAnimatingOverlay::SetLayerCycle( int iLayer, float flCycle, float flPr
|
||||
m_AnimOverlay[iLayer].MarkActive( );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
void CBaseAnimatingOverlay::SetLayerCycle( int iLayer, float flCycle, float flPrevCycle, float flLastEventCheck )
|
||||
{
|
||||
if (!IsValidLayer( iLayer ))
|
||||
return;
|
||||
|
||||
if (!m_AnimOverlay[iLayer].m_bLooping)
|
||||
{
|
||||
flCycle = clamp( flCycle, 0.0f, 1.0f );
|
||||
flPrevCycle = clamp( flPrevCycle, 0.0f, 1.0f );
|
||||
}
|
||||
m_AnimOverlay[iLayer].m_flCycle = flCycle;
|
||||
m_AnimOverlay[iLayer].m_flPrevCycle = flPrevCycle;
|
||||
m_AnimOverlay[iLayer].m_flLastEventCheck = flLastEventCheck;
|
||||
m_AnimOverlay[iLayer].MarkActive( );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -165,7 +165,6 @@ public:
|
||||
|
||||
void SetLayerCycle( int iLayer, float flCycle );
|
||||
void SetLayerCycle( int iLayer, float flCycle, float flPrevCycle );
|
||||
void SetLayerCycle( int iLayer, float flCycle, float flPrevCycle, float flLastEventCheck );
|
||||
float GetLayerCycle( int iLayer );
|
||||
|
||||
void SetLayerPlaybackRate( int iLayer, float flPlaybackRate );
|
||||
|
||||
@@ -839,7 +839,7 @@ void CC_CommentaryChanged( IConVar *pConVar, const char *pOldString, float flOld
|
||||
g_CommentarySystem.SetCommentaryMode( var.GetBool() );
|
||||
}
|
||||
}
|
||||
ConVar commentary( "commentary", "0", FCVAR_NONE, "Desired commentary mode state.", CC_CommentaryChanged );
|
||||
ConVar commentary("commentary", "0", FCVAR_ARCHIVE | FCVAR_ARCHIVE_XBOX, "Desired commentary mode state.", CC_CommentaryChanged );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: We need to revert back any convar changes that are made by the
|
||||
|
||||
@@ -155,7 +155,7 @@ bool BasicGameStats_t::ParseFromBuffer( CUtlBuffer& buf, int iBufferStatsVersion
|
||||
for ( int i = 0; i < c; ++i )
|
||||
{
|
||||
char mapname[ 256 ];
|
||||
buf.GetString( mapname );
|
||||
buf.GetString( mapname, sizeof( mapname ) );
|
||||
|
||||
BasicGameStatsRecord_t *rec = FindOrAddRecordForMap( mapname );
|
||||
bool valid= rec->ParseFromBuffer( buf, iBufferStatsVersion );
|
||||
|
||||
@@ -271,7 +271,7 @@ void CMaterialModifyControl::InputStartFloatLerp( inputdata_t &inputdata )
|
||||
{
|
||||
bool bWrap = atoi(pszParam) != 0;
|
||||
// We don't implement wrap currently.
|
||||
NOTE_UNUSED( bWrap );
|
||||
bWrap = bWrap;
|
||||
|
||||
// Got all the parameters. Save 'em and return;
|
||||
m_flFloatLerpStartValue = flStartValue;
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
|
||||
#include "cbase.h"
|
||||
|
||||
#include "AttributeTool.h"
|
||||
#include "nav_mesh.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
#ifdef SERVER_USES_VGUI
|
||||
|
||||
using namespace vgui;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
AttributeToolPanel::AttributeToolPanel( vgui::Panel *parent, const char *toolName ) : CNavUIToolPanel( parent, toolName )
|
||||
{
|
||||
LoadControlSettings( "Resource/UI/NavTools/AttributeTool.res" );
|
||||
}
|
||||
|
||||
#endif // SERVER_USES_VGUI
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
@@ -1,23 +0,0 @@
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
|
||||
#ifndef ATTRIBUTETOOL_H
|
||||
#define ATTRIBUTETOOL_H
|
||||
|
||||
#include "NavUI.h"
|
||||
#include "nav.h"
|
||||
|
||||
#ifdef SERVER_USES_VGUI
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
class AttributeToolPanel : public CNavUIToolPanel
|
||||
{
|
||||
DECLARE_CLASS_SIMPLE( AttributeToolPanel, CNavUIToolPanel );
|
||||
|
||||
public:
|
||||
AttributeToolPanel( vgui::Panel *parent, const char *toolName );
|
||||
};
|
||||
|
||||
#endif // SERVER_USES_VGUI
|
||||
|
||||
#endif // ATTRIBUTETOOL_H
|
||||
@@ -1,25 +0,0 @@
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
|
||||
#include "cbase.h"
|
||||
|
||||
#include "MeshTool.h"
|
||||
#include "nav_mesh.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
#ifdef SERVER_USES_VGUI
|
||||
|
||||
using namespace vgui;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
MeshToolPanel::MeshToolPanel( vgui::Panel *parent, const char *toolName ) : CNavUIToolPanel( parent, toolName )
|
||||
{
|
||||
LoadControlSettings( "Resource/UI/NavTools/MeshTool.res" );
|
||||
}
|
||||
|
||||
#endif // SERVER_USES_VGUI
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
@@ -1,24 +0,0 @@
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
|
||||
#ifndef MESHTOOL_H
|
||||
#define MESHTOOL_H
|
||||
|
||||
#ifdef SERVER_USES_VGUI
|
||||
|
||||
#include "NavUI.h"
|
||||
#include "nav.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
class MeshToolPanel : public CNavUIToolPanel
|
||||
{
|
||||
DECLARE_CLASS_SIMPLE( MeshToolPanel, CNavUIToolPanel );
|
||||
|
||||
public:
|
||||
MeshToolPanel( vgui::Panel *parent, const char *toolName );
|
||||
};
|
||||
|
||||
#endif // SERVER_USES_VGUI
|
||||
|
||||
#endif // MESHTOOL_H
|
||||
@@ -1,48 +0,0 @@
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
|
||||
#include "cbase.h"
|
||||
|
||||
#ifdef SERVER_USES_VGUI
|
||||
#include <filesystem.h>
|
||||
#include "NavMenu.h"
|
||||
#include "vgui_controls/MenuItem.h"
|
||||
#endif // SERVER_USES_VGUI
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
#ifdef SERVER_USES_VGUI
|
||||
|
||||
using namespace vgui;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
NavMenu::NavMenu( Panel *parent, const char *panelName ) : Menu( parent, panelName )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
bool NavMenu::LoadFromFile( const char * fileName) // load menu from KeyValues
|
||||
{
|
||||
KeyValues * kv = new KeyValues(fileName);
|
||||
|
||||
if ( !kv->LoadFromFile( filesystem, fileName, "GAME" ) )
|
||||
return false;
|
||||
|
||||
bool ret = false;//LoadFromKeyValues( kv );
|
||||
|
||||
kv->deleteThis();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
NavMenu::~NavMenu()
|
||||
{
|
||||
}
|
||||
|
||||
#endif // SERVER_USES_VGUI
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
@@ -1,30 +0,0 @@
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
|
||||
#ifndef NAV_MENU_H
|
||||
#define NAV_MENU_H
|
||||
|
||||
#ifdef SERVER_USES_VGUI
|
||||
|
||||
#include <vgui_controls/Menu.h>
|
||||
#include <game/client/iviewport.h>
|
||||
#include <filesystem.h>
|
||||
#include "utlstack.h"
|
||||
#include "utlvector.h"
|
||||
#include <KeyValues.h>
|
||||
|
||||
class NavMenu : public vgui::Menu
|
||||
{
|
||||
private:
|
||||
DECLARE_CLASS_SIMPLE( NavMenu, vgui::Menu );
|
||||
|
||||
public:
|
||||
NavMenu( vgui::Panel *parent, const char *panelName );
|
||||
~NavMenu();
|
||||
|
||||
bool LoadFromFile( const char * fileName ); // load menu from file (via KeyValues)
|
||||
};
|
||||
|
||||
#endif // SERVER_USES_VGUI
|
||||
|
||||
#endif // NAV_MENU_H
|
||||
@@ -1,892 +0,0 @@
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
|
||||
#include "cbase.h"
|
||||
|
||||
#ifdef SERVER_USES_VGUI
|
||||
|
||||
#include "NavUI.h"
|
||||
#include "filesystem.h"
|
||||
#include "tier0/icommandline.h"
|
||||
#include "vgui_gamedll_int.h"
|
||||
#include "ienginevgui.h"
|
||||
#include "IGameUIFuncs.h"
|
||||
#include "fmtstr.h"
|
||||
#include "NavMenu.h"
|
||||
#include <vgui_controls/MenuButton.h>
|
||||
|
||||
#include "SelectionTool.h"
|
||||
#include "MeshTool.h"
|
||||
#include "AttributeTool.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
using namespace vgui;
|
||||
class CNavUIBasePanel;
|
||||
class CNavUIToolPanel;
|
||||
|
||||
extern IGameUIFuncs *gameuifuncs;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
static CNavUIBasePanel *s_navUIPanel = NULL;
|
||||
CNavUIBasePanel *TheNavUI( void )
|
||||
{
|
||||
return s_navUIPanel;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
ConVar NavGUIRebuild( "nav_gui_rebuild", "0", FCVAR_CHEAT, "Rebuilds the nav ui windows from scratch every time they're opened" );
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUIButton::LookupKey( void )
|
||||
{
|
||||
if ( m_hideKey == BUTTON_CODE_INVALID )
|
||||
m_hideKey = (gameuifuncs) ? gameuifuncs->GetButtonCodeForBind( "nav_gui" ) : BUTTON_CODE_INVALID;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUIButton::OnKeyCodePressed( KeyCode code )
|
||||
{
|
||||
LookupKey();
|
||||
|
||||
if ( code == m_hideKey )
|
||||
{
|
||||
m_hidePressedTimer.Start();
|
||||
return;
|
||||
}
|
||||
|
||||
BaseClass::OnKeyCodePressed( code );
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUIButton::OnKeyCodeReleased( KeyCode code )
|
||||
{
|
||||
LookupKey();
|
||||
|
||||
if ( code == m_hideKey )
|
||||
{
|
||||
if ( m_hidePressedTimer.HasStarted() && m_hidePressedTimer.GetElapsedTime() < 0.5f )
|
||||
{
|
||||
s_navUIPanel->ToggleVisibility();
|
||||
m_hidePressedTimer.Invalidate();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
BaseClass::OnKeyCodeReleased( code );
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUITextEntry::LookupKey( void )
|
||||
{
|
||||
if ( m_hideKey == BUTTON_CODE_INVALID )
|
||||
m_hideKey = (gameuifuncs) ? gameuifuncs->GetButtonCodeForBind( "nav_gui" ) : BUTTON_CODE_INVALID;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUITextEntry::OnKeyCodePressed( KeyCode code )
|
||||
{
|
||||
LookupKey();
|
||||
|
||||
if ( code == m_hideKey )
|
||||
{
|
||||
m_hidePressedTimer.Start();
|
||||
return;
|
||||
}
|
||||
|
||||
BaseClass::OnKeyCodePressed( code );
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUITextEntry::OnKeyCodeReleased( KeyCode code )
|
||||
{
|
||||
LookupKey();
|
||||
|
||||
if ( code == m_hideKey )
|
||||
{
|
||||
if ( m_hidePressedTimer.HasStarted() && m_hidePressedTimer.GetElapsedTime() < 0.5f )
|
||||
{
|
||||
s_navUIPanel->ToggleVisibility();
|
||||
m_hidePressedTimer.Invalidate();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
BaseClass::OnKeyCodeReleased( code );
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUIComboBox::LookupKey( void )
|
||||
{
|
||||
if ( m_hideKey == BUTTON_CODE_INVALID )
|
||||
m_hideKey = (gameuifuncs) ? gameuifuncs->GetButtonCodeForBind( "nav_gui" ) : BUTTON_CODE_INVALID;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUIComboBox::OnKeyCodePressed( KeyCode code )
|
||||
{
|
||||
LookupKey();
|
||||
|
||||
if ( code == m_hideKey )
|
||||
{
|
||||
m_hidePressedTimer.Start();
|
||||
return;
|
||||
}
|
||||
|
||||
BaseClass::OnKeyCodePressed( code );
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUIComboBox::OnKeyCodeReleased( KeyCode code )
|
||||
{
|
||||
LookupKey();
|
||||
|
||||
if ( code == m_hideKey )
|
||||
{
|
||||
if ( m_hidePressedTimer.HasStarted() && m_hidePressedTimer.GetElapsedTime() < 0.5f )
|
||||
{
|
||||
s_navUIPanel->ToggleVisibility();
|
||||
m_hidePressedTimer.Invalidate();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
BaseClass::OnKeyCodeReleased( code );
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUICheckButton::LookupKey( void )
|
||||
{
|
||||
if ( m_hideKey == BUTTON_CODE_INVALID )
|
||||
m_hideKey = (gameuifuncs) ? gameuifuncs->GetButtonCodeForBind( "nav_gui" ) : BUTTON_CODE_INVALID;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUICheckButton::OnKeyCodePressed( KeyCode code )
|
||||
{
|
||||
LookupKey();
|
||||
|
||||
if ( code == m_hideKey )
|
||||
{
|
||||
m_hidePressedTimer.Start();
|
||||
return;
|
||||
}
|
||||
|
||||
BaseClass::OnKeyCodePressed( code );
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUICheckButton::OnKeyCodeReleased( KeyCode code )
|
||||
{
|
||||
LookupKey();
|
||||
|
||||
if ( code == m_hideKey )
|
||||
{
|
||||
if ( m_hidePressedTimer.HasStarted() && m_hidePressedTimer.GetElapsedTime() < 0.5f )
|
||||
{
|
||||
s_navUIPanel->ToggleVisibility();
|
||||
m_hidePressedTimer.Invalidate();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
BaseClass::OnKeyCodeReleased( code );
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
CNavUIBasePanel::CNavUIBasePanel() : vgui::Frame( NULL, "NavUI" )
|
||||
{
|
||||
m_hideKey = BUTTON_CODE_INVALID;
|
||||
SetScheme( "SourceScheme" );
|
||||
LoadControlSettings( "Resource/UI/NavUI.res" );
|
||||
SetAlpha( 0 );
|
||||
SetMouseInputEnabled( false );
|
||||
SetSizeable( false );
|
||||
SetMoveable( false );
|
||||
SetCloseButtonVisible( false );
|
||||
SetTitleBarVisible( false );
|
||||
|
||||
SetLeftClickAction( "", "" );
|
||||
|
||||
m_hidden = false;
|
||||
m_toolPanel = NULL;
|
||||
m_selectionPanel = NULL;
|
||||
|
||||
SetTitle( "", true);
|
||||
|
||||
m_dragSelecting = m_dragUnselecting = false;
|
||||
|
||||
MenuButton *menuButton = dynamic_cast< MenuButton * >(FindChildByName( "FileMenuButton" ));
|
||||
if ( menuButton )
|
||||
{
|
||||
NavMenu * menu = new NavMenu( menuButton, "NavFileMenu" );
|
||||
menu->AddMenuItem( "Quit", "Quit", new KeyValues( "Command", "command", "StopEditing" ), this );
|
||||
menuButton->SetMenu( menu );
|
||||
menuButton->SetOpenDirection( Menu::DOWN );
|
||||
}
|
||||
|
||||
menuButton = dynamic_cast< MenuButton * >(FindChildByName( "SelectionMenuButton" ));
|
||||
if ( menuButton )
|
||||
{
|
||||
NavMenu * menu = new NavMenu( menuButton, "NavSelectionMenu" );
|
||||
menu->AddMenuItem( "Flood Select", "Flood Select", new KeyValues( "Command", "command", "FloodSelect" ), this );
|
||||
menu->AddMenuItem( "Flood Select (fog)", "Flood Select (Fog)", new KeyValues( "Command", "command", "FloodSelect fog" ), this );
|
||||
menuButton->SetMenu( menu );
|
||||
menuButton->SetOpenDirection( Menu::DOWN );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
CNavUIBasePanel::~CNavUIBasePanel()
|
||||
{
|
||||
s_navUIPanel = NULL;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUIBasePanel::SetLeftClickAction( const char *action, const char *text )
|
||||
{
|
||||
if ( !action || !*action )
|
||||
{
|
||||
action = "Selection::Select";
|
||||
}
|
||||
|
||||
if ( !text || !*text )
|
||||
{
|
||||
text = "Select";
|
||||
}
|
||||
|
||||
V_strncpy( m_leftClickAction, action, sizeof( m_leftClickAction ) );
|
||||
m_performingLeftClickAction = false;
|
||||
|
||||
vgui::Label *label = dynamic_cast< vgui::Label * >(FindChildByName( "LeftClick" ) );
|
||||
if ( label )
|
||||
{
|
||||
label->SetText( UTIL_VarArgs( "Left Click: %s", text ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUIBasePanel::ApplySchemeSettings( IScheme *pScheme )
|
||||
{
|
||||
BaseClass::ApplySchemeSettings( pScheme );
|
||||
SetBgColor( Color( 0, 0, 0, 0 ) );
|
||||
|
||||
Panel *panel = FindChildByName( "SidebarParent" );
|
||||
if ( panel )
|
||||
{
|
||||
panel->SetBgColor( Color( 128, 128, 128, 255 ) );
|
||||
panel->SetPaintBackgroundType( 2 );
|
||||
}
|
||||
|
||||
panel = FindChildByName( "MenuParent" );
|
||||
if ( panel )
|
||||
{
|
||||
panel->SetBgColor( Color( 128, 128, 128, 255 ) );
|
||||
panel->SetPaintBackgroundType( 0 );
|
||||
}
|
||||
|
||||
panel = FindChildByName( "ToolParent" );
|
||||
if ( panel )
|
||||
{
|
||||
panel->SetBgColor( Color( 0, 0, 0, 128 ) );
|
||||
panel->SetPaintBackgroundType( 0 );
|
||||
}
|
||||
|
||||
panel = FindChildByName( "SelectionParent" );
|
||||
if ( panel )
|
||||
{
|
||||
panel->SetBgColor( Color( 0, 0, 0, 128 ) );
|
||||
panel->SetPaintBackgroundType( 0 );
|
||||
}
|
||||
|
||||
panel = FindChildByName( "MouseFeedbackParent" );
|
||||
if ( panel )
|
||||
{
|
||||
panel->SetBgColor( Color( 0, 0, 0, 128 ) );
|
||||
panel->SetPaintBackgroundType( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUIBasePanel::PerformLayout( void )
|
||||
{
|
||||
int wide, tall;
|
||||
vgui::surface()->GetScreenSize( wide, tall );
|
||||
SetBounds( 0, 0, wide, tall );
|
||||
|
||||
Panel *panel = FindChildByName( "MenuParent" );
|
||||
if ( panel )
|
||||
{
|
||||
int oldWide, oldTall;
|
||||
panel->GetSize( oldWide, oldTall );
|
||||
panel->SetSize( wide, oldTall );
|
||||
}
|
||||
|
||||
BaseClass::PerformLayout();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUIBasePanel::PaintBackground( void )
|
||||
{
|
||||
BaseClass::PaintBackground();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
const char *CNavUIBasePanel::ActiveToolName( void ) const
|
||||
{
|
||||
if ( m_toolPanel )
|
||||
return m_toolPanel->GetName();
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUIBasePanel::ActivateTool( const char *toolName )
|
||||
{
|
||||
if ( m_toolPanel && FStrEq( m_toolPanel->GetName(), toolName ) )
|
||||
{
|
||||
m_toolPanel->Shutdown();
|
||||
m_toolPanel->MarkForDeletion();
|
||||
m_toolPanel = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_toolPanel )
|
||||
{
|
||||
m_toolPanel->Shutdown();
|
||||
m_toolPanel->MarkForDeletion();
|
||||
m_toolPanel = NULL;
|
||||
}
|
||||
|
||||
Panel *toolParent = FindChildByName( "ToolParent" );
|
||||
if ( !toolParent )
|
||||
toolParent = this;
|
||||
|
||||
m_toolPanel = CreateTool( toolName, toolParent );
|
||||
if ( m_toolPanel )
|
||||
{
|
||||
m_toolPanel->Init();
|
||||
m_toolPanel->SetVisible( true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
CNavUIToolPanel *CNavUIBasePanel::CreateTool( const char *toolName, vgui::Panel *toolParent )
|
||||
{
|
||||
if ( FStrEq( toolName, "Selection" ) )
|
||||
{
|
||||
return new SelectionToolPanel( toolParent, toolName );
|
||||
}
|
||||
if ( FStrEq( toolName, "Mesh" ) )
|
||||
{
|
||||
return new MeshToolPanel( toolParent, toolName );
|
||||
}
|
||||
if ( FStrEq( toolName, "Attribute" ) )
|
||||
{
|
||||
return new AttributeToolPanel( toolParent, toolName );
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUIBasePanel::OnCommand( const char *command )
|
||||
{
|
||||
CSplitString argv( command, " " );
|
||||
|
||||
if ( FStrEq( "Close", command ) )
|
||||
{
|
||||
ToggleVisibility();
|
||||
}
|
||||
else if ( FStrEq( "MeshTool", command ) )
|
||||
{
|
||||
ActivateTool( "Mesh" );
|
||||
return;
|
||||
}
|
||||
else if ( FStrEq( "AttributesTool", command ) )
|
||||
{
|
||||
ActivateTool( "Attribute" );
|
||||
return;
|
||||
}
|
||||
else if ( FStrEq( "StopEditing", command ) )
|
||||
{
|
||||
MarkForDeletion();
|
||||
engine->ServerCommand( "nav_edit 0\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseClass::OnCommand( command );
|
||||
}
|
||||
|
||||
// argv can't delete individual elements
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// GameUI panels are always visible by default, so here we hide ourselves if the GameUI is up.
|
||||
void CNavUIBasePanel::OnTick( void )
|
||||
{
|
||||
CBasePlayer *player = UTIL_GetListenServerHost();
|
||||
if ( !player || !player->IsConnected() )
|
||||
{
|
||||
m_hidden = true;
|
||||
SetVisible( false );
|
||||
vgui::ivgui()->RemoveTickSignal( GetVPanel() );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( enginevgui->IsGameUIVisible() )
|
||||
{
|
||||
if ( GetAlpha() != 0 )
|
||||
{
|
||||
SetAlpha( 0 );
|
||||
SetMouseInputEnabled( false );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( m_hidden )
|
||||
{
|
||||
if ( GetAlpha() > 0 )
|
||||
{
|
||||
SetAlpha( 0 );
|
||||
SetMouseInputEnabled( false );
|
||||
}
|
||||
|
||||
SetVisible( false );
|
||||
vgui::ivgui()->RemoveTickSignal( GetVPanel() );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( GetAlpha() < 255 )
|
||||
{
|
||||
SetAlpha( 255 );
|
||||
SetMouseInputEnabled( true );
|
||||
|
||||
if ( !m_selectionPanel )
|
||||
{
|
||||
Panel *selectionParent = FindChildByName( "SelectionParent" );
|
||||
if ( !selectionParent )
|
||||
selectionParent = this;
|
||||
|
||||
m_selectionPanel = CreateTool( "Selection", selectionParent );
|
||||
if ( m_selectionPanel )
|
||||
{
|
||||
m_selectionPanel->Init();
|
||||
m_selectionPanel->SetVisible( true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CFmtStr str;
|
||||
if ( m_toolPanel )
|
||||
{
|
||||
str.sprintf( "%s - %s", STRING( gpGlobals->mapname ), m_toolPanel->GetName() );
|
||||
}
|
||||
else
|
||||
{
|
||||
str.sprintf( "%s", STRING( gpGlobals->mapname ) );
|
||||
}
|
||||
SetTitle( str.Access(), true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUIBasePanel::ToggleVisibility( void )
|
||||
{
|
||||
m_hidden = !m_hidden;
|
||||
|
||||
if ( m_hidden && NavGUIRebuild.GetBool() )
|
||||
{
|
||||
MarkForDeletion();
|
||||
s_navUIPanel = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
Panel *CNavUIBasePanel::CreateControlByName( const char *controlName )
|
||||
{
|
||||
if ( FStrEq( controlName, "Button" ) )
|
||||
{
|
||||
return new CNavUIButton( this, "CNavUIButton" );
|
||||
}
|
||||
|
||||
if ( FStrEq( controlName, "TextEntry" ) )
|
||||
{
|
||||
return new CNavUITextEntry( this, "CNavUITextEntry" );
|
||||
}
|
||||
|
||||
if ( FStrEq( controlName, "ComboBox" ) )
|
||||
{
|
||||
return new CNavUIComboBox( this, "CNavUIComboBox", 5, false );
|
||||
}
|
||||
|
||||
if ( FStrEq( controlName, "CheckButton" ) )
|
||||
{
|
||||
return new CNavUICheckButton( this, "CNavUICheckButton", "" );
|
||||
}
|
||||
|
||||
return BaseClass::CreateControlByName( controlName );
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
Panel *CNavUIToolPanel::CreateControlByName( const char *controlName )
|
||||
{
|
||||
if ( s_navUIPanel )
|
||||
{
|
||||
return s_navUIPanel->CreateControlByName( controlName );
|
||||
}
|
||||
|
||||
return BaseClass::CreateControlByName( controlName );
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
bool CNavUIToolPanel::IsCheckButtonChecked( const char *name )
|
||||
{
|
||||
vgui::CheckButton *checkButton = dynamic_cast< vgui::CheckButton * >( FindChildByName( name, true ) );
|
||||
if ( !checkButton )
|
||||
return false;
|
||||
|
||||
return checkButton->IsSelected();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUIBasePanel::LookupKey( void )
|
||||
{
|
||||
if ( m_hideKey == BUTTON_CODE_INVALID )
|
||||
m_hideKey = (gameuifuncs) ? gameuifuncs->GetButtonCodeForBind( "nav_gui" ) : BUTTON_CODE_INVALID;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUIBasePanel::OnKeyCodePressed( KeyCode code )
|
||||
{
|
||||
LookupKey();
|
||||
|
||||
if ( code == m_hideKey )
|
||||
{
|
||||
m_hidePressedTimer.Start();
|
||||
return;
|
||||
}
|
||||
|
||||
BaseClass::OnKeyCodePressed( code );
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUIBasePanel::OnKeyCodeReleased( KeyCode code )
|
||||
{
|
||||
LookupKey();
|
||||
|
||||
if ( code == m_hideKey )
|
||||
{
|
||||
if ( m_hidePressedTimer.HasStarted() && m_hidePressedTimer.GetElapsedTime() < 0.5f )
|
||||
{
|
||||
s_navUIPanel->ToggleVisibility();
|
||||
m_hidePressedTimer.Invalidate();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
BaseClass::OnKeyCodeReleased( code );
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUIBasePanel::OnCursorEntered( void )
|
||||
{
|
||||
BaseClass::OnCursorEntered();
|
||||
|
||||
if ( m_performingLeftClickAction )
|
||||
{
|
||||
if ( m_toolPanel )
|
||||
{
|
||||
m_toolPanel->FinishLeftClickAction( m_leftClickAction );
|
||||
}
|
||||
if ( m_selectionPanel )
|
||||
{
|
||||
m_selectionPanel->FinishLeftClickAction( m_leftClickAction );
|
||||
}
|
||||
m_performingLeftClickAction = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUIBasePanel::OnCursorMoved( int x, int y )
|
||||
{
|
||||
if ( m_toolPanel )
|
||||
{
|
||||
m_toolPanel->OnCursorMoved( x, y );
|
||||
}
|
||||
if ( m_selectionPanel )
|
||||
{
|
||||
m_selectionPanel->OnCursorMoved( x, y );
|
||||
}
|
||||
|
||||
BaseClass::OnCursorMoved( x, y );
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUIBasePanel::OnCursorExited( void )
|
||||
{
|
||||
BaseClass::OnCursorExited();
|
||||
|
||||
if ( m_performingLeftClickAction )
|
||||
{
|
||||
if ( m_toolPanel )
|
||||
{
|
||||
m_toolPanel->FinishLeftClickAction( m_leftClickAction );
|
||||
}
|
||||
if ( m_selectionPanel )
|
||||
{
|
||||
m_selectionPanel->FinishLeftClickAction( m_leftClickAction );
|
||||
}
|
||||
m_performingLeftClickAction = false;
|
||||
}
|
||||
/*
|
||||
if ( m_dragSelecting || m_dragUnselecting )
|
||||
{
|
||||
PlaySound( "EDIT_END_AREA.Creating" );
|
||||
}
|
||||
m_dragSelecting = false;
|
||||
m_dragUnselecting = false;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUIBasePanel::OnMousePressed( MouseCode code )
|
||||
{
|
||||
/*
|
||||
CNavArea *area = TheNavMesh->GetSelectedArea();
|
||||
*/
|
||||
|
||||
switch ( code )
|
||||
{
|
||||
case MOUSE_LEFT:
|
||||
m_performingLeftClickAction = true;
|
||||
if ( m_toolPanel )
|
||||
{
|
||||
m_toolPanel->StartLeftClickAction( m_leftClickAction );
|
||||
}
|
||||
if ( m_selectionPanel )
|
||||
{
|
||||
m_selectionPanel->StartLeftClickAction( m_leftClickAction );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
BaseClass::OnMousePressed( code );
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUIBasePanel::OnMouseReleased( MouseCode code )
|
||||
{
|
||||
switch ( code )
|
||||
{
|
||||
case MOUSE_LEFT:
|
||||
if ( m_performingLeftClickAction )
|
||||
{
|
||||
if ( m_toolPanel )
|
||||
{
|
||||
m_toolPanel->FinishLeftClickAction( m_leftClickAction );
|
||||
}
|
||||
if ( m_selectionPanel )
|
||||
{
|
||||
m_selectionPanel->FinishLeftClickAction( m_leftClickAction );
|
||||
}
|
||||
m_performingLeftClickAction = false;
|
||||
}
|
||||
break;
|
||||
case MOUSE_RIGHT:
|
||||
if ( m_toolPanel )
|
||||
{
|
||||
m_toolPanel->StartRightClickAction( "Selection::ClearSelection" );
|
||||
}
|
||||
if ( m_selectionPanel )
|
||||
{
|
||||
m_selectionPanel->StartRightClickAction( "Selection::ClearSelection" );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
BaseClass::OnMousePressed( code );
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void CNavUIBasePanel::PlaySound( const char *sound )
|
||||
{
|
||||
CBasePlayer *player = UTIL_GetListenServerHost();
|
||||
if ( player )
|
||||
{
|
||||
player->EmitSound( sound );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// Taken from cl_dll/view.cpp
|
||||
float ScaleFOVByWidthRatio( float fovDegrees, float ratio )
|
||||
{
|
||||
float halfAngleRadians = fovDegrees * ( 0.5f * M_PI / 180.0f );
|
||||
float t = tan( halfAngleRadians );
|
||||
t *= ratio;
|
||||
float retDegrees = ( 180.0f / M_PI ) * atan( t );
|
||||
return retDegrees * 2.0f;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Given a field of view and mouse/screen positions as well as the current
|
||||
// render origin and angles, returns a unit vector through the mouse position
|
||||
// that can be used to trace into the world under the mouse click pixel.
|
||||
// Input :
|
||||
// mousex -
|
||||
// mousey -
|
||||
// fov -
|
||||
// vecRenderOrigin -
|
||||
// vecRenderAngles -
|
||||
// Output :
|
||||
// vecPickingRay
|
||||
// Adapted from cl_dll/c_vguiscreen.cpp
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void ScreenToWorld( int mousex, int mousey, float fov,
|
||||
const Vector& vecRenderOrigin,
|
||||
const QAngle& vecRenderAngles,
|
||||
Vector& vecPickingRay )
|
||||
{
|
||||
float dx, dy;
|
||||
float c_x, c_y;
|
||||
float dist;
|
||||
Vector vpn, vup, vright;
|
||||
|
||||
int wide, tall;
|
||||
vgui::surface()->GetScreenSize( wide, tall );
|
||||
c_x = wide / 2;
|
||||
c_y = tall / 2;
|
||||
|
||||
float scaled_fov = ScaleFOVByWidthRatio( fov, (float)wide / (float)tall * 0.75f );
|
||||
|
||||
dx = (float)mousex - c_x;
|
||||
// Invert Y
|
||||
dy = c_y - (float)mousey;
|
||||
|
||||
// Convert view plane distance
|
||||
dist = c_x / tan( M_PI * scaled_fov / 360.0 );
|
||||
|
||||
// Decompose view angles
|
||||
AngleVectors( vecRenderAngles, &vpn, &vright, &vup );
|
||||
|
||||
// Offset forward by view plane distance, and then by pixel offsets
|
||||
vecPickingRay = vpn * dist + vright * ( dx ) + vup * ( dy );
|
||||
|
||||
// Convert to unit vector
|
||||
VectorNormalize( vecPickingRay );
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void GetNavUIEditVectors( Vector *pos, Vector *forward )
|
||||
{
|
||||
CBasePlayer *player = UTIL_GetListenServerHost();
|
||||
if ( !player )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !s_navUIPanel )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( s_navUIPanel->GetAlpha() < 255 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int x, y;
|
||||
vgui::surface()->SurfaceGetCursorPos( x, y );
|
||||
|
||||
float fov = player->GetFOV();
|
||||
QAngle eyeAngles = player->EyeAngles();
|
||||
Vector eyePosition = player->EyePosition();
|
||||
|
||||
Vector pick;
|
||||
ScreenToWorld( x, y, fov, eyePosition, eyeAngles, pick );
|
||||
|
||||
*forward = pick;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void NavUICommand( void )
|
||||
{
|
||||
if ( engine->IsDedicatedServer() )
|
||||
return;
|
||||
|
||||
if ( UTIL_GetCommandClient() != UTIL_GetListenServerHost() )
|
||||
return;
|
||||
|
||||
engine->ServerCommand( "nav_edit 1\n" );
|
||||
bool created = false;
|
||||
if ( !s_navUIPanel )
|
||||
{
|
||||
created = true;
|
||||
s_navUIPanel = CreateNavUI();
|
||||
}
|
||||
|
||||
ShowGameDLLPanel( s_navUIPanel );
|
||||
vgui::ivgui()->AddTickSignal( s_navUIPanel->GetVPanel() );
|
||||
if ( !created )
|
||||
{
|
||||
s_navUIPanel->ToggleVisibility();
|
||||
}
|
||||
}
|
||||
ConCommand nav_gui( "nav_gui", NavUICommand, "Opens the nav editing GUI", FCVAR_CHEAT );
|
||||
|
||||
#endif // SERVER_USES_VGUI
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
@@ -1,220 +0,0 @@
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
|
||||
#ifndef NAVUI_H
|
||||
#define NAVUI_H
|
||||
|
||||
#ifdef SERVER_USES_VGUI
|
||||
|
||||
#include "KeyValues.h"
|
||||
#include <vgui_controls/ImagePanel.h>
|
||||
#include <vgui_controls/Button.h>
|
||||
#include <vgui_controls/Frame.h>
|
||||
#include <vgui_controls/ComboBox.h>
|
||||
#include <vgui_controls/TextEntry.h>
|
||||
#include <vgui_controls/CheckButton.h>
|
||||
#include <vgui/ILocalize.h>
|
||||
#include "vgui/ISurface.h"
|
||||
#include "vgui/IVGui.h"
|
||||
#include "fmtstr.h"
|
||||
#include <vgui_controls/CheckButton.h>
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void GetNavUIEditVectors( Vector *pos, Vector *forward );
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
class CNavUIButton : public vgui::Button
|
||||
{
|
||||
DECLARE_CLASS_SIMPLE( CNavUIButton, vgui::Button );
|
||||
|
||||
public:
|
||||
CNavUIButton( Panel *parent, const char *name ) : vgui::Button( parent, name, "" )
|
||||
{
|
||||
m_hideKey = BUTTON_CODE_INVALID;
|
||||
}
|
||||
|
||||
virtual void OnKeyCodePressed( vgui::KeyCode code );
|
||||
virtual void OnKeyCodeReleased( vgui::KeyCode code );
|
||||
|
||||
private:
|
||||
void LookupKey( void );
|
||||
|
||||
ButtonCode_t m_hideKey;
|
||||
IntervalTimer m_hidePressedTimer;
|
||||
};
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
class CNavUITextEntry : public vgui::TextEntry
|
||||
{
|
||||
DECLARE_CLASS_SIMPLE( CNavUIButton, vgui::TextEntry );
|
||||
|
||||
public:
|
||||
CNavUITextEntry( Panel *parent, const char *name ) : vgui::TextEntry( parent, name )
|
||||
{
|
||||
m_hideKey = BUTTON_CODE_INVALID;
|
||||
}
|
||||
|
||||
virtual void OnKeyCodePressed( vgui::KeyCode code );
|
||||
virtual void OnKeyCodeReleased( vgui::KeyCode code );
|
||||
|
||||
private:
|
||||
void LookupKey( void );
|
||||
|
||||
ButtonCode_t m_hideKey;
|
||||
IntervalTimer m_hidePressedTimer;
|
||||
};
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
class CNavUIComboBox : public vgui::ComboBox
|
||||
{
|
||||
DECLARE_CLASS_SIMPLE( CNavUIComboBox, vgui::ComboBox );
|
||||
|
||||
public:
|
||||
CNavUIComboBox( Panel *parent, const char *name, int numLines, bool editable ) : vgui::ComboBox( parent, name, numLines, editable )
|
||||
{
|
||||
m_hideKey = BUTTON_CODE_INVALID;
|
||||
}
|
||||
|
||||
virtual void OnKeyCodePressed( vgui::KeyCode code );
|
||||
virtual void OnKeyCodeReleased( vgui::KeyCode code );
|
||||
|
||||
private:
|
||||
void LookupKey( void );
|
||||
|
||||
ButtonCode_t m_hideKey;
|
||||
IntervalTimer m_hidePressedTimer;
|
||||
};
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
class CNavUICheckButton : public vgui::CheckButton
|
||||
{
|
||||
DECLARE_CLASS_SIMPLE( CNavUICheckButton, vgui::CheckButton );
|
||||
|
||||
public:
|
||||
CNavUICheckButton( Panel *parent, const char *name, const char *text ) : vgui::CheckButton( parent, name, text )
|
||||
{
|
||||
m_hideKey = BUTTON_CODE_INVALID;
|
||||
}
|
||||
|
||||
virtual void OnKeyCodePressed( vgui::KeyCode code );
|
||||
virtual void OnKeyCodeReleased( vgui::KeyCode code );
|
||||
|
||||
private:
|
||||
void LookupKey( void );
|
||||
|
||||
ButtonCode_t m_hideKey;
|
||||
IntervalTimer m_hidePressedTimer;
|
||||
};
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
class CNavUIToolPanel : public vgui::EditablePanel
|
||||
{
|
||||
DECLARE_CLASS_SIMPLE( CNavUIToolPanel, vgui::EditablePanel );
|
||||
|
||||
public:
|
||||
CNavUIToolPanel( vgui::Panel *parent, const char *toolName ) : vgui::EditablePanel( parent, toolName )
|
||||
{
|
||||
}
|
||||
|
||||
virtual void Init( void )
|
||||
{
|
||||
}
|
||||
|
||||
virtual void Shutdown( void )
|
||||
{
|
||||
}
|
||||
|
||||
virtual vgui::Panel *CreateControlByName( const char *controlName );
|
||||
|
||||
virtual void StartLeftClickAction( const char *actionName )
|
||||
{
|
||||
}
|
||||
|
||||
virtual void FinishLeftClickAction( const char *actionName )
|
||||
{
|
||||
}
|
||||
|
||||
virtual void StartRightClickAction( const char *actionName )
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
bool IsCheckButtonChecked( const char *name );
|
||||
};
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
class CNavUIBasePanel : public vgui::Frame
|
||||
{
|
||||
DECLARE_CLASS_SIMPLE( CNavUIBasePanel, vgui::Frame );
|
||||
|
||||
public:
|
||||
CNavUIBasePanel();
|
||||
virtual ~CNavUIBasePanel();
|
||||
|
||||
virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
|
||||
virtual void OnCommand( const char *command );
|
||||
virtual void PerformLayout( void );
|
||||
virtual void PaintBackground( void );
|
||||
|
||||
// GameUI panels are always visible by default, so here we hide ourselves if the GameUI is up.
|
||||
virtual void OnTick( void );
|
||||
|
||||
void ToggleVisibility( void );
|
||||
virtual Panel *CreateControlByName( const char *controlName );
|
||||
|
||||
virtual void OnKeyCodePressed( vgui::KeyCode code );
|
||||
virtual void OnKeyCodeReleased( vgui::KeyCode code );
|
||||
virtual void OnMousePressed( vgui::MouseCode code );
|
||||
|
||||
virtual void OnCursorMoved( int x, int y );
|
||||
virtual void OnCursorEntered( void );
|
||||
virtual void OnCursorExited( void );
|
||||
virtual void OnMouseReleased( vgui::MouseCode code );
|
||||
|
||||
void SetLeftClickAction( const char *action, const char *text );
|
||||
const char *GetLeftClickAction( void ) const
|
||||
{
|
||||
return m_leftClickAction;
|
||||
}
|
||||
|
||||
void PlaySound( const char *sound );
|
||||
|
||||
protected:
|
||||
const char *ActiveToolName( void ) const;
|
||||
void ActivateTool( const char *toolName );
|
||||
virtual CNavUIToolPanel *CreateTool( const char *toolName, vgui::Panel *toolParent );
|
||||
|
||||
private:
|
||||
bool m_hidden;
|
||||
|
||||
bool m_dragSelecting;
|
||||
bool m_dragUnselecting;
|
||||
|
||||
CNavUIToolPanel *m_toolPanel;
|
||||
CNavUIToolPanel *m_selectionPanel;
|
||||
|
||||
void LookupKey( void );
|
||||
|
||||
ButtonCode_t m_hideKey;
|
||||
IntervalTimer m_hidePressedTimer;
|
||||
|
||||
CountdownTimer m_audioTimer;
|
||||
|
||||
char m_leftClickAction[ 64 ];
|
||||
bool m_performingLeftClickAction;
|
||||
};
|
||||
|
||||
|
||||
extern CNavUIBasePanel *CreateNavUI( void );
|
||||
extern CNavUIBasePanel *TheNavUI( void );
|
||||
|
||||
#endif // SERVER_USES_VGUI
|
||||
|
||||
#endif // NAVUI_H
|
||||
@@ -1,242 +0,0 @@
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
|
||||
#include "cbase.h"
|
||||
|
||||
#include "SelectionTool.h"
|
||||
#include "nav_mesh.h"
|
||||
#include "nav_pathfind.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
#ifdef SERVER_USES_VGUI
|
||||
|
||||
using namespace vgui;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
SelectionToolPanel::SelectionToolPanel( vgui::Panel *parent, const char *toolName ) : CNavUIToolPanel( parent, toolName )
|
||||
{
|
||||
LoadControlSettings( "Resource/UI/NavTools/SelectionTool.res" );
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void SelectionToolPanel::Init( void )
|
||||
{
|
||||
m_dragType = DRAG_NONE;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void SelectionToolPanel::Shutdown( void )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void SelectionToolPanel::PerformLayout( void )
|
||||
{
|
||||
Panel *parent = GetParent();
|
||||
if ( parent )
|
||||
{
|
||||
int w, h;
|
||||
parent->GetSize( w, h );
|
||||
SetBounds( 0, 0, w, h );
|
||||
}
|
||||
|
||||
BaseClass::PerformLayout();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void SelectionToolPanel::OnCommand( const char *command )
|
||||
{
|
||||
if ( FStrEq( "FloodSelect", command ) )
|
||||
{
|
||||
TheNavUI()->SetLeftClickAction( "Selection::Flood", "Flood Select" );
|
||||
}
|
||||
|
||||
BaseClass::OnCommand( command );
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void SelectionToolPanel::OnCursorMoved( int x, int y )
|
||||
{
|
||||
CNavArea *area = TheNavMesh->GetSelectedArea();
|
||||
if ( area )
|
||||
{
|
||||
bool selected = TheNavMesh->IsInSelectedSet( area );
|
||||
|
||||
if ( selected && m_dragType == DRAG_UNSELECT )
|
||||
{
|
||||
TheNavMesh->RemoveFromSelectedSet( area );
|
||||
TheNavUI()->PlaySound( "EDIT_END_AREA.Creating" );
|
||||
}
|
||||
else if ( !selected && m_dragType == DRAG_SELECT )
|
||||
{
|
||||
TheNavMesh->AddToSelectedSet( area );
|
||||
TheNavUI()->PlaySound( "EDIT_END_AREA.Creating" );
|
||||
}
|
||||
}
|
||||
|
||||
BaseClass::OnCursorMoved( x, y );
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
class FloodSelectionCollector
|
||||
{
|
||||
public:
|
||||
FloodSelectionCollector( SelectionToolPanel *panel )
|
||||
{
|
||||
m_count = 0;
|
||||
m_panel = panel;
|
||||
}
|
||||
|
||||
bool operator() ( CNavArea *area )
|
||||
{
|
||||
// already selected areas terminate flood select
|
||||
if ( TheNavMesh->IsInSelectedSet( area ) )
|
||||
return false;
|
||||
|
||||
if ( !m_panel->IsFloodSelectable( area ) )
|
||||
return false;
|
||||
|
||||
TheNavMesh->AddToSelectedSet( area );
|
||||
++m_count;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int m_count;
|
||||
|
||||
private:
|
||||
SelectionToolPanel *m_panel;
|
||||
};
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
bool SelectionToolPanel::IsFloodSelectable( CNavArea *area )
|
||||
{
|
||||
if ( IsCheckButtonChecked( "Place" ) )
|
||||
{
|
||||
if ( m_floodStartArea->GetPlace() != area->GetPlace() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ( IsCheckButtonChecked( "Jump" ) )
|
||||
{
|
||||
if ( (m_floodStartArea->GetAttributes() & NAV_MESH_JUMP) != (area->GetAttributes() & NAV_MESH_JUMP) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void SelectionToolPanel::FloodSelect( void )
|
||||
{
|
||||
m_floodStartArea = TheNavMesh->GetSelectedArea();
|
||||
if ( m_floodStartArea )
|
||||
{
|
||||
TheNavUI()->PlaySound( "EDIT_DELETE" );
|
||||
|
||||
int connections = INCLUDE_BLOCKED_AREAS;
|
||||
|
||||
if ( IsCheckButtonChecked( "Incoming" ) )
|
||||
{
|
||||
connections = connections | INCLUDE_INCOMING_CONNECTIONS;
|
||||
}
|
||||
|
||||
if ( !IsCheckButtonChecked( "Outgoing" ) )
|
||||
{
|
||||
connections = connections | EXCLUDE_OUTGOING_CONNECTIONS;
|
||||
}
|
||||
|
||||
// collect all areas connected to this area
|
||||
FloodSelectionCollector collector( this );
|
||||
SearchSurroundingAreas( m_floodStartArea, m_floodStartArea->GetCenter(), collector, -1, connections );
|
||||
|
||||
Msg( "Selected %d areas.\n", collector.m_count );
|
||||
}
|
||||
m_floodStartArea = NULL;
|
||||
|
||||
TheNavMesh->SetMarkedArea( NULL ); // unmark the mark area
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void SelectionToolPanel::StartLeftClickAction( const char *actionName )
|
||||
{
|
||||
if ( FStrEq( actionName, "Selection::Flood" ) )
|
||||
{
|
||||
TheNavUI()->SetLeftClickAction( "", "" );
|
||||
FloodSelect();
|
||||
}
|
||||
else if ( FStrEq( actionName, "Selection::Select" ) )
|
||||
{
|
||||
CNavArea *area = TheNavMesh->GetSelectedArea();
|
||||
if ( area )
|
||||
{
|
||||
if ( TheNavMesh->IsInSelectedSet( area ) )
|
||||
{
|
||||
TheNavMesh->RemoveFromSelectedSet( area );
|
||||
m_dragType = DRAG_UNSELECT;
|
||||
}
|
||||
else
|
||||
{
|
||||
TheNavMesh->AddToSelectedSet( area );
|
||||
m_dragType = DRAG_SELECT;
|
||||
}
|
||||
TheNavUI()->PlaySound( "EDIT_END_AREA.Creating" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void SelectionToolPanel::FinishLeftClickAction( const char *actionName )
|
||||
{
|
||||
m_dragType = DRAG_NONE;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
void SelectionToolPanel::StartRightClickAction( const char *actionName )
|
||||
{
|
||||
if ( m_dragType != DRAG_NONE )
|
||||
{
|
||||
TheNavUI()->PlaySound( "EDIT_END_AREA.Creating" );
|
||||
m_dragType = DRAG_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( FStrEq( actionName, "Selection::ClearSelection" ) )
|
||||
{
|
||||
if ( FStrEq( TheNavUI()->GetLeftClickAction(), "Selection::Select" ) )
|
||||
{
|
||||
if ( TheNavMesh->GetSelecteSetSize() > 0 )
|
||||
{
|
||||
TheNavUI()->PlaySound( "EDIT_END_AREA.Creating" );
|
||||
}
|
||||
TheNavMesh->ClearSelectedSet();
|
||||
}
|
||||
else
|
||||
{
|
||||
TheNavUI()->SetLeftClickAction( "", "" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SERVER_USES_VGUI
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
@@ -1,48 +0,0 @@
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
|
||||
#ifndef SELECTIONTOOL_H
|
||||
#define SELECTIONTOOL_H
|
||||
|
||||
#ifdef SERVER_USES_VGUI
|
||||
|
||||
#include "NavUI.h"
|
||||
#include "nav.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------
|
||||
class SelectionToolPanel : public CNavUIToolPanel
|
||||
{
|
||||
DECLARE_CLASS_SIMPLE( SelectionToolPanel, CNavUIToolPanel );
|
||||
|
||||
public:
|
||||
SelectionToolPanel( vgui::Panel *parent, const char *toolName );
|
||||
|
||||
virtual void Init( void );
|
||||
virtual void Shutdown( void );
|
||||
virtual void PerformLayout( void );
|
||||
virtual void OnCommand( const char *command );
|
||||
|
||||
virtual void StartLeftClickAction( const char *actionName );
|
||||
virtual void FinishLeftClickAction( const char *actionName );
|
||||
virtual void StartRightClickAction( const char *actionName );
|
||||
virtual void OnCursorMoved( int x, int y );
|
||||
|
||||
virtual bool IsFloodSelectable( CNavArea *area );
|
||||
|
||||
protected:
|
||||
void FloodSelect( void );
|
||||
CNavArea *m_floodStartArea;
|
||||
|
||||
enum DragSelectType
|
||||
{
|
||||
DRAG_NONE,
|
||||
DRAG_SELECT,
|
||||
DRAG_UNSELECT
|
||||
};
|
||||
DragSelectType m_dragType;
|
||||
};
|
||||
|
||||
#endif // SERVER_USES_VGUI
|
||||
|
||||
#endif // SELECTIONTOOL_H
|
||||
@@ -25,7 +25,7 @@ enum QueryResultType
|
||||
};
|
||||
|
||||
// Can pass this into IContextualQuery::IsHindrance to see if any hindrance is ever possible
|
||||
#define IS_ANY_HINDRANCE_POSSIBLE ( (CBaseEntity*)0xFFFFFFFF )
|
||||
#define IS_ANY_HINDRANCE_POSSIBLE ( (CBaseEntity*)-1 )
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -108,9 +108,6 @@ IHandleEntity *CServerNetworkProperty::GetEntityHandle( )
|
||||
void CServerNetworkProperty::Release()
|
||||
{
|
||||
delete m_pOuter;
|
||||
// Don't zero m_pOuter or reference any member variables after
|
||||
// the delete call because the object may be deleted.
|
||||
//m_pOuter = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -385,7 +385,7 @@ void Templates_RemoveAll(void)
|
||||
free(pTemplate->pszMapData);
|
||||
if ( pTemplate->pszFixedMapData )
|
||||
{
|
||||
free(pTemplate->pszFixedMapData);
|
||||
delete[] pTemplate->pszFixedMapData;
|
||||
}
|
||||
|
||||
free(pTemplate);
|
||||
|
||||
@@ -1686,11 +1686,6 @@ void CAI_BaseNPC::InitDefaultActivitySR(void)
|
||||
ADD_ACTIVITY_TO_SR( ACT_MP_ATTACK_SWIM_GRENADE_ITEM2 );
|
||||
ADD_ACTIVITY_TO_SR( ACT_MP_ATTACK_AIRWALK_GRENADE_ITEM2 );
|
||||
|
||||
// Passtime
|
||||
ADD_ACTIVITY_TO_SR( ACT_MP_STAND_PASSTIME );
|
||||
ADD_ACTIVITY_TO_SR( ACT_MP_RUN_PASSTIME );
|
||||
ADD_ACTIVITY_TO_SR( ACT_MP_CROUCHWALK_PASSTIME );
|
||||
|
||||
// Flinches
|
||||
ADD_ACTIVITY_TO_SR( ACT_MP_GESTURE_FLINCH );
|
||||
ADD_ACTIVITY_TO_SR( ACT_MP_GESTURE_FLINCH_PRIMARY );
|
||||
@@ -1831,7 +1826,6 @@ void CAI_BaseNPC::InitDefaultActivitySR(void)
|
||||
ADD_ACTIVITY_TO_SR( ACT_MP_DOUBLEJUMP_CROUCH_ITEM1 );
|
||||
ADD_ACTIVITY_TO_SR( ACT_MP_DOUBLEJUMP_CROUCH_ITEM2 );
|
||||
ADD_ACTIVITY_TO_SR( ACT_MP_DOUBLEJUMP_CROUCH_LOSERSTATE );
|
||||
ADD_ACTIVITY_TO_SR( ACT_MP_DOUBLEJUMP_CROUCH_PASSTIME );
|
||||
|
||||
ADD_ACTIVITY_TO_SR( ACT_MP_GESTURE_VC_HANDMOUTH );
|
||||
ADD_ACTIVITY_TO_SR( ACT_MP_GESTURE_VC_FINGERPOINT );
|
||||
@@ -1893,11 +1887,6 @@ void CAI_BaseNPC::InitDefaultActivitySR(void)
|
||||
ADD_ACTIVITY_TO_SR( ACT_MP_STUN_MIDDLE );
|
||||
ADD_ACTIVITY_TO_SR( ACT_MP_STUN_END );
|
||||
|
||||
ADD_ACTIVITY_TO_SR( ACT_MP_PASSTIME_THROW_BEGIN );
|
||||
ADD_ACTIVITY_TO_SR( ACT_MP_PASSTIME_THROW_MIDDLE );
|
||||
ADD_ACTIVITY_TO_SR( ACT_MP_PASSTIME_THROW_END );
|
||||
ADD_ACTIVITY_TO_SR( ACT_MP_PASSTIME_THROW_CANCEL );
|
||||
|
||||
ADD_ACTIVITY_TO_SR( ACT_VM_UNUSABLE );
|
||||
ADD_ACTIVITY_TO_SR( ACT_VM_UNUSABLE_TO_USABLE );
|
||||
ADD_ACTIVITY_TO_SR( ACT_VM_USABLE_TO_UNUSABLE );
|
||||
@@ -2168,84 +2157,4 @@ void CAI_BaseNPC::InitDefaultActivitySR(void)
|
||||
ADD_ACTIVITY_TO_SR( ACT_SPELL_VM_IDLE );
|
||||
ADD_ACTIVITY_TO_SR( ACT_SPELL_VM_ARM );
|
||||
ADD_ACTIVITY_TO_SR( ACT_SPELL_VM_FIRE );
|
||||
|
||||
ADD_ACTIVITY_TO_SR( ACT_BREADSAPPER_VM_DRAW );
|
||||
ADD_ACTIVITY_TO_SR( ACT_BREADSAPPER_VM_IDLE );
|
||||
|
||||
ADD_ACTIVITY_TO_SR( ACT_BREADGLOVES_VM_HITLEFT );
|
||||
ADD_ACTIVITY_TO_SR( ACT_BREADGLOVES_VM_HITRIGHT );
|
||||
ADD_ACTIVITY_TO_SR( ACT_BREADGLOVES_VM_SWINGHARD );
|
||||
ADD_ACTIVITY_TO_SR( ACT_BREADGLOVES_VM_IDLE );
|
||||
ADD_ACTIVITY_TO_SR( ACT_BREADGLOVES_VM_DRAW );
|
||||
|
||||
ADD_ACTIVITY_TO_SR( ACT_BREADMONSTER_GLOVES_IDLE );
|
||||
ADD_ACTIVITY_TO_SR( ACT_BREADMONSTER_GLOVES_HITRIGHT );
|
||||
ADD_ACTIVITY_TO_SR( ACT_BREADMONSTER_GLOVES_HITUP );
|
||||
|
||||
ADD_ACTIVITY_TO_SR( ACT_BREADMONSTER_VM_DRAW );
|
||||
ADD_ACTIVITY_TO_SR( ACT_BREADMONSTER_VM_IDLE );
|
||||
ADD_ACTIVITY_TO_SR( ACT_BREADMONSTER_VM_PRIMARYATTACK );
|
||||
|
||||
ADD_ACTIVITY_TO_SR( ACT_PARACHUTE_DEPLOY );
|
||||
ADD_ACTIVITY_TO_SR( ACT_PARACHUTE_DEPLOY_IDLE );
|
||||
ADD_ACTIVITY_TO_SR( ACT_PARACHUTE_RETRACT );
|
||||
ADD_ACTIVITY_TO_SR( ACT_PARACHUTE_RETRACT_IDLE );
|
||||
|
||||
ADD_ACTIVITY_TO_SR( ACT_BOT_SPAWN );
|
||||
ADD_ACTIVITY_TO_SR( ACT_BOT_PANIC );
|
||||
ADD_ACTIVITY_TO_SR( ACT_BOT_PRIMARY_MOVEMENT );
|
||||
ADD_ACTIVITY_TO_SR( ACT_BOT_GESTURE_FLINCH );
|
||||
ADD_ACTIVITY_TO_SR( ACT_BOT_PANIC_START );
|
||||
ADD_ACTIVITY_TO_SR( ACT_BOT_PANIC_END );
|
||||
|
||||
ADD_ACTIVITY_TO_SR( ACT_ENGINEER_REVOLVER_DRAW );
|
||||
ADD_ACTIVITY_TO_SR( ACT_ENGINEER_REVOLVER_IDLE );
|
||||
ADD_ACTIVITY_TO_SR( ACT_ENGINEER_REVOLVER_PRIMARYATTACK );
|
||||
ADD_ACTIVITY_TO_SR( ACT_ENGINEER_REVOLVER_RELOAD );
|
||||
|
||||
ADD_ACTIVITY_TO_SR( ACT_KART_IDLE );
|
||||
ADD_ACTIVITY_TO_SR( ACT_KART_ACTION_SHOOT );
|
||||
ADD_ACTIVITY_TO_SR( ACT_KART_ACTION_DASH );
|
||||
ADD_ACTIVITY_TO_SR( ACT_KART_JUMP_START );
|
||||
ADD_ACTIVITY_TO_SR( ACT_KART_JUMP_FLOAT );
|
||||
ADD_ACTIVITY_TO_SR( ACT_KART_JUMP_LAND );
|
||||
ADD_ACTIVITY_TO_SR( ACT_KART_IMPACT );
|
||||
ADD_ACTIVITY_TO_SR( ACT_KART_IMPACT_BIG );
|
||||
ADD_ACTIVITY_TO_SR( ACT_KART_GESTURE_POSITIVE );
|
||||
ADD_ACTIVITY_TO_SR( ACT_KART_GESTURE_NEGATIVE );
|
||||
|
||||
ADD_ACTIVITY_TO_SR( ACT_GRAPPLE_DRAW );
|
||||
ADD_ACTIVITY_TO_SR( ACT_GRAPPLE_IDLE );
|
||||
ADD_ACTIVITY_TO_SR( ACT_GRAPPLE_FIRE_START );
|
||||
ADD_ACTIVITY_TO_SR( ACT_GRAPPLE_FIRE_IDLE );
|
||||
ADD_ACTIVITY_TO_SR( ACT_GRAPPLE_PULL_START );
|
||||
ADD_ACTIVITY_TO_SR( ACT_GRAPPLE_PULL_IDLE );
|
||||
ADD_ACTIVITY_TO_SR( ACT_GRAPPLE_PULL_END );
|
||||
|
||||
ADD_ACTIVITY_TO_SR( ACT_PRIMARY_VM_INSPECT_START );
|
||||
ADD_ACTIVITY_TO_SR( ACT_PRIMARY_VM_INSPECT_IDLE );
|
||||
ADD_ACTIVITY_TO_SR( ACT_PRIMARY_VM_INSPECT_END );
|
||||
|
||||
ADD_ACTIVITY_TO_SR( ACT_SECONDARY_VM_INSPECT_START );
|
||||
ADD_ACTIVITY_TO_SR( ACT_SECONDARY_VM_INSPECT_IDLE );
|
||||
ADD_ACTIVITY_TO_SR( ACT_SECONDARY_VM_INSPECT_END );
|
||||
|
||||
ADD_ACTIVITY_TO_SR( ACT_MELEE_VM_INSPECT_START );
|
||||
ADD_ACTIVITY_TO_SR( ACT_MELEE_VM_INSPECT_IDLE );
|
||||
ADD_ACTIVITY_TO_SR( ACT_MELEE_VM_INSPECT_END );
|
||||
|
||||
ADD_ACTIVITY_TO_SR( ACT_BALL_VM_CATCH );
|
||||
ADD_ACTIVITY_TO_SR( ACT_BALL_VM_PICKUP );
|
||||
ADD_ACTIVITY_TO_SR( ACT_BALL_VM_IDLE );
|
||||
ADD_ACTIVITY_TO_SR( ACT_BALL_VM_THROW_START );
|
||||
ADD_ACTIVITY_TO_SR( ACT_BALL_VM_THROW_LOOP );
|
||||
ADD_ACTIVITY_TO_SR( ACT_BALL_VM_THROW_END );
|
||||
|
||||
ADD_ACTIVITY_TO_SR( ACT_MP_COMPETITIVE_LOSERSTATE );
|
||||
ADD_ACTIVITY_TO_SR( ACT_MP_COMPETITIVE_WINNERSTATE );
|
||||
|
||||
ADD_ACTIVITY_TO_SR( ACT_SECONDARY_VM_ALTATTACK );
|
||||
ADD_ACTIVITY_TO_SR( ACT_MP_PUSH_STAND_SECONDARY );
|
||||
ADD_ACTIVITY_TO_SR( ACT_MP_PUSH_CROUCH_SECONDARY );
|
||||
ADD_ACTIVITY_TO_SR( ACT_MP_PUSH_SWIM_SECONDARY );
|
||||
}
|
||||
|
||||
@@ -7710,9 +7710,7 @@ CBaseEntity *CAI_BaseNPC::BestEnemy( void )
|
||||
if (!pEnemy || !pEnemy->IsAlive())
|
||||
{
|
||||
if ( pEnemy )
|
||||
{
|
||||
DbgEnemyMsg( this, " %s rejected: dead\n", pEnemy->GetDebugName() );
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -7787,9 +7785,7 @@ CBaseEntity *CAI_BaseNPC::BestEnemy( void )
|
||||
{
|
||||
DbgEnemyMsg( this, " %s accepted (1)\n", pEnemy->GetDebugName() );
|
||||
if ( pBestEnemy )
|
||||
{
|
||||
DbgEnemyMsg( this, " (%s displaced)\n", pBestEnemy->GetDebugName() );
|
||||
}
|
||||
|
||||
iBestPriority = IRelationPriority ( pEnemy );
|
||||
iBestDistSq = (pEnemy->GetAbsOrigin() - GetAbsOrigin() ).LengthSqr();
|
||||
@@ -7803,9 +7799,7 @@ CBaseEntity *CAI_BaseNPC::BestEnemy( void )
|
||||
{
|
||||
DbgEnemyMsg( this, " %s accepted\n", pEnemy->GetDebugName() );
|
||||
if ( pBestEnemy )
|
||||
{
|
||||
DbgEnemyMsg( this, " (%s displaced due to priority, %d > %d )\n", pBestEnemy->GetDebugName(), IRelationPriority( pEnemy ), iBestPriority );
|
||||
}
|
||||
// this entity is disliked MORE than the entity that we
|
||||
// currently think is the best visible enemy. No need to do
|
||||
// a distance check, just get mad at this one for now.
|
||||
@@ -7939,9 +7933,7 @@ CBaseEntity *CAI_BaseNPC::BestEnemy( void )
|
||||
|
||||
DbgEnemyMsg( this, " %s accepted\n", pEnemy->GetDebugName() );
|
||||
if ( pBestEnemy )
|
||||
{
|
||||
DbgEnemyMsg( this, " (%s displaced due to distance/visibility)\n", pBestEnemy->GetDebugName() );
|
||||
}
|
||||
fBestSeen = fCurSeen;
|
||||
fBestVisible = fCurVisible;
|
||||
iBestDistSq = iDistSq;
|
||||
@@ -7950,9 +7942,7 @@ CBaseEntity *CAI_BaseNPC::BestEnemy( void )
|
||||
bBestUnreachable = bUnreachable;
|
||||
}
|
||||
else
|
||||
{
|
||||
DbgEnemyMsg( this, " %s rejected: lower priority\n", pEnemy->GetDebugName() );
|
||||
}
|
||||
}
|
||||
|
||||
DbgEnemyMsg( this, "} == %s\n", pBestEnemy->GetDebugName() );
|
||||
@@ -8043,7 +8033,6 @@ float CAI_BaseNPC::CalcIdealYaw( const Vector &vecTarget )
|
||||
{
|
||||
vecProjection.x = -vecTarget.y;
|
||||
vecProjection.y = vecTarget.x;
|
||||
vecProjection.z = 0;
|
||||
|
||||
return UTIL_VecToYaw( vecProjection - GetLocalOrigin() );
|
||||
}
|
||||
@@ -8051,7 +8040,6 @@ float CAI_BaseNPC::CalcIdealYaw( const Vector &vecTarget )
|
||||
{
|
||||
vecProjection.x = vecTarget.y;
|
||||
vecProjection.y = vecTarget.x;
|
||||
vecProjection.z = 0;
|
||||
|
||||
return UTIL_VecToYaw( vecProjection - GetLocalOrigin() );
|
||||
}
|
||||
@@ -11343,6 +11331,7 @@ CAI_BaseNPC::CAI_BaseNPC(void)
|
||||
m_flHeadYaw = 0;
|
||||
m_flHeadPitch = 0;
|
||||
m_spawnEquipment = NULL_STRING;
|
||||
m_SquadName = NULL_STRING;
|
||||
m_pEnemies = new CAI_Enemies;
|
||||
m_bIgnoreUnseenEnemies = false;
|
||||
m_flEyeIntegRate = 0.95;
|
||||
|
||||
@@ -1761,6 +1761,7 @@ public:
|
||||
|
||||
virtual Activity GetFlinchActivity( bool bHeavyDamage, bool bGesture );
|
||||
|
||||
virtual bool ShouldGib( const CTakeDamageInfo &info ) { return false; } // Always ragdoll, unless specified by the leaf class
|
||||
virtual bool Event_Gibbed( const CTakeDamageInfo &info );
|
||||
virtual void Event_Killed( const CTakeDamageInfo &info );
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ struct AI_Follower_t
|
||||
}
|
||||
|
||||
AIHANDLE hFollower;
|
||||
int slot;
|
||||
intp slot;
|
||||
AI_FollowNavInfo_t navInfo;
|
||||
AI_FollowGroup_t * pGroup; // backpointer for efficiency
|
||||
};
|
||||
@@ -2561,7 +2561,7 @@ bool CAI_FollowManager::AddFollower( CBaseEntity *pTarget, CAI_BaseNPC *pFollowe
|
||||
|
||||
AI_FollowSlot_t *pSlot = &pGroup->pFormation->pSlots[slot];
|
||||
|
||||
int i = pGroup->followers.AddToTail( );
|
||||
intp i = pGroup->followers.AddToTail( );
|
||||
|
||||
AI_Follower_t *iterNode = &pGroup->followers[i];
|
||||
iterNode->hFollower = pFollower;
|
||||
@@ -2569,9 +2569,8 @@ bool CAI_FollowManager::AddFollower( CBaseEntity *pTarget, CAI_BaseNPC *pFollowe
|
||||
iterNode->pGroup = pGroup;
|
||||
|
||||
pGroup->slotUsage.Set( slot );
|
||||
|
||||
CalculateFieldsFromSlot( pSlot, &iterNode->navInfo );
|
||||
|
||||
|
||||
pHandle->m_hFollower = i;
|
||||
pHandle->m_pGroup = pGroup;
|
||||
return true;
|
||||
@@ -2641,10 +2640,10 @@ bool CAI_FollowManager::RedistributeSlots( AI_FollowGroup_t *pGroup )
|
||||
{
|
||||
AI_FollowSlot_t * pSlot = &pGroup->pFormation->pSlots[bestSlot];
|
||||
Vector slotPos = originFollowed + pSlot->position;
|
||||
int h = pGroup->followers.Head();
|
||||
int hBest = pGroup->followers.InvalidIndex();
|
||||
intp h = pGroup->followers.Head();
|
||||
intp hBest = pGroup->followers.InvalidIndex();
|
||||
float distSqBest = FLT_MAX;
|
||||
|
||||
|
||||
while ( h != pGroup->followers.InvalidIndex() )
|
||||
{
|
||||
AI_Follower_t *p = &pGroup->followers[h];
|
||||
@@ -2691,7 +2690,7 @@ void CAI_FollowManager::ChangeFormation( AI_FollowManagerInfoHandle_t& hInfo, AI
|
||||
if ( pNewFormation == pGroup->pFormation )
|
||||
return;
|
||||
|
||||
int h = pGroup->followers.Head();
|
||||
intp h = pGroup->followers.Head();
|
||||
|
||||
while ( h != pGroup->followers.InvalidIndex() )
|
||||
{
|
||||
@@ -2738,7 +2737,7 @@ void CAI_FollowManager::RemoveFollower( AI_FollowManagerInfoHandle_t& hInfo )
|
||||
AI_FollowGroup_t *pGroup = hInfo.m_pGroup;
|
||||
AI_Follower_t* iterNode = &pGroup->followers[hInfo.m_hFollower];
|
||||
|
||||
int slot = iterNode->slot;
|
||||
intp slot = iterNode->slot;
|
||||
pGroup->slotUsage.Clear( slot );
|
||||
pGroup->followers.Remove( hInfo.m_hFollower );
|
||||
if ( pGroup->followers.Count() == 0 )
|
||||
@@ -2846,7 +2845,7 @@ AI_FollowGroup_t *CAI_FollowManager::FindFollowerGroup( CBaseEntity *pFollower )
|
||||
{
|
||||
for ( int i = 0; i < m_groups.Count(); i++ )
|
||||
{
|
||||
int h = m_groups[i]->followers.Head();
|
||||
intp h = m_groups[i]->followers.Head();
|
||||
while( h != m_groups[i]->followers.InvalidIndex() )
|
||||
{
|
||||
AI_Follower_t *p = &m_groups[i]->followers[h];
|
||||
|
||||
@@ -100,7 +100,7 @@ struct AI_FollowGroup_t;
|
||||
struct AI_FollowManagerInfoHandle_t
|
||||
{
|
||||
AI_FollowGroup_t *m_pGroup;
|
||||
int m_hFollower;
|
||||
intp m_hFollower;
|
||||
};
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
@@ -269,7 +269,7 @@ bool CAI_LeadBehavior::GetClosestPointOnRoute( const Vector &targetPos, Vector *
|
||||
float flNearestDist = 999999999;
|
||||
float flPathDist, flPathDist2D;
|
||||
|
||||
Vector vecNearestPoint(0, 0, 0);
|
||||
Vector vecNearestPoint;
|
||||
Vector vecPrevPos = GetOuter()->GetAbsOrigin();
|
||||
for ( ; (waypoint != NULL) ; waypoint = waypoint->GetNext() )
|
||||
{
|
||||
@@ -1540,24 +1540,24 @@ void CAI_LeadGoal::InputActivate( inputdata_t &inputdata )
|
||||
m_flRetrieveDistance = m_flLeadDistance + LEAD_MIN_RETRIEVEDIST_OFFSET;
|
||||
}
|
||||
|
||||
AI_LeadArgs_t leadArgs = {
|
||||
GetGoalEntityName(),
|
||||
STRING(m_iszWaitPointName),
|
||||
(unsigned)m_spawnflags,
|
||||
m_flWaitDistance,
|
||||
m_flLeadDistance,
|
||||
m_flRetrieveDistance,
|
||||
AI_LeadArgs_t leadArgs = {
|
||||
GetGoalEntityName(),
|
||||
STRING(m_iszWaitPointName),
|
||||
(unsigned)m_spawnflags,
|
||||
m_flWaitDistance,
|
||||
m_flLeadDistance,
|
||||
m_flRetrieveDistance,
|
||||
m_flSuccessDistance,
|
||||
m_bRun,
|
||||
m_iRetrievePlayer,
|
||||
m_iRetrieveWaitForSpeak,
|
||||
m_iComingBackWaitForSpeak,
|
||||
m_bRun,
|
||||
m_iRetrievePlayer,
|
||||
m_iRetrieveWaitForSpeak,
|
||||
m_iComingBackWaitForSpeak,
|
||||
m_bStopScenesWhenPlayerLost,
|
||||
m_bDontSpeakStart,
|
||||
m_bLeadDuringCombat,
|
||||
m_bGagLeader,
|
||||
};
|
||||
|
||||
|
||||
pBehavior->LeadPlayer( leadArgs, this );
|
||||
}
|
||||
|
||||
|
||||
@@ -25,17 +25,7 @@
|
||||
ConVar DrawBattleLines( "ai_drawbattlelines", "0", FCVAR_CHEAT );
|
||||
|
||||
|
||||
// XXX(JohnS): The old parameters below triggered a warning -- fPlayerIsBattleline field used to be "1.5" which
|
||||
// implicitly cast to true. Given that there are two floats followed by three ints, it seems all these
|
||||
// fields are off-by-one, but this code hasn't been touched in a very long time so I'm going to avoid
|
||||
// changing its behavior drastically now. It probably has never used the originally intended values. The
|
||||
// new values are just expanding what they would've been implicitly filled with.
|
||||
//
|
||||
// static AI_StandoffParams_t AI_DEFAULT_STANDOFF_PARAMS = { AIHCR_MOVE_ON_COVER, true, 1.5, 2.5, 1, 3, 25, 0 };
|
||||
static AI_StandoffParams_t AI_DEFAULT_STANDOFF_PARAMS = { AIHCR_MOVE_ON_COVER, true, true, 2.5, 1., 3, 25, 0, false, 0.f };
|
||||
// Suspected originally intended values:
|
||||
//
|
||||
// static AI_StandoffParams_t AI_DEFAULT_STANDOFF_PARAMS = { AIHCR_MOVE_ON_COVER, true, true(?), 1.5, 2.5, 1, 3, 25, false(?), 0.(?) };
|
||||
|
||||
#define MAKE_ACTMAP_KEY( posture, activity ) ( (((unsigned)(posture)) << 16) | ((unsigned)(activity)) )
|
||||
|
||||
|
||||
@@ -1864,7 +1864,7 @@ float ChangeDistance( float flInterval, float flGoalDistance, float flGoalVeloci
|
||||
// I need to speed up
|
||||
flNewVelocity = flCurVelocity + flGoalAccel * flInterval;
|
||||
if (flNewVelocity > flGoalVelocity)
|
||||
flNewVelocity = flGoalVelocity;
|
||||
flGoalVelocity = flGoalVelocity;
|
||||
}
|
||||
else if (flNewVelocity < flIdealVelocity)
|
||||
{
|
||||
|
||||
@@ -137,6 +137,11 @@ public:
|
||||
return pResult;
|
||||
}
|
||||
|
||||
void operator delete(void *p)
|
||||
{
|
||||
MemAlloc_Free( p );
|
||||
};
|
||||
|
||||
private:
|
||||
CAI_BaseNPC *m_pOuter;
|
||||
};
|
||||
|
||||
@@ -51,8 +51,8 @@ enum AIMsgFlags
|
||||
AIMF_IGNORE_SELECTED = 0x01
|
||||
};
|
||||
|
||||
void DevMsg( CAI_BaseNPC *pAI, unsigned flags, PRINTF_FORMAT_STRING const char *pszFormat, ... ) FMTFUNCTION( 3, 4 );
|
||||
void DevMsg( CAI_BaseNPC *pAI, PRINTF_FORMAT_STRING const char *pszFormat, ... ) FMTFUNCTION( 2, 3 );
|
||||
void DevMsg( CAI_BaseNPC *pAI, unsigned flags, PRINTF_FORMAT_STRING const char *pszFormat, ... );
|
||||
void DevMsg( CAI_BaseNPC *pAI, PRINTF_FORMAT_STRING const char *pszFormat, ... );
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -729,7 +729,7 @@ CAI_Hint *CAI_HintManager::GetFirstHint( AIHintIter_t *pIter )
|
||||
{
|
||||
if ( !gm_AllHints.Count() )
|
||||
{
|
||||
*pIter = (AIHintIter_t)gm_AllHints.InvalidIndex();
|
||||
*pIter = (AIHintIter_t)(intp)gm_AllHints.InvalidIndex();
|
||||
return NULL;
|
||||
}
|
||||
*pIter = (AIHintIter_t)0;
|
||||
@@ -741,12 +741,12 @@ CAI_Hint *CAI_HintManager::GetFirstHint( AIHintIter_t *pIter )
|
||||
//-----------------------------------------------------------------------------
|
||||
CAI_Hint *CAI_HintManager::GetNextHint( AIHintIter_t *pIter )
|
||||
{
|
||||
if ( (int)*pIter != gm_AllHints.InvalidIndex() )
|
||||
if ( (intp)*pIter != gm_AllHints.InvalidIndex() )
|
||||
{
|
||||
int i = ( (int)*pIter ) + 1;
|
||||
intp i = ( (intp)*pIter ) + 1;
|
||||
if ( gm_AllHints.Count() <= i )
|
||||
{
|
||||
*pIter = (AIHintIter_t)gm_AllHints.InvalidIndex();
|
||||
*pIter = (AIHintIter_t)(intp)gm_AllHints.InvalidIndex();
|
||||
return NULL;
|
||||
}
|
||||
*pIter = (AIHintIter_t)i;
|
||||
|
||||
@@ -176,7 +176,7 @@ CAI_Enemies::~CAI_Enemies()
|
||||
AI_EnemyInfo_t *CAI_Enemies::GetFirst( AIEnemiesIter_t *pIter )
|
||||
{
|
||||
CMemMap::IndexType_t i = m_Map.FirstInorder();
|
||||
*pIter = (AIEnemiesIter_t)(unsigned)i;
|
||||
*pIter = (AIEnemiesIter_t)(uintp)i;
|
||||
|
||||
if ( i == m_Map.InvalidIndex() )
|
||||
return NULL;
|
||||
@@ -191,13 +191,13 @@ AI_EnemyInfo_t *CAI_Enemies::GetFirst( AIEnemiesIter_t *pIter )
|
||||
|
||||
AI_EnemyInfo_t *CAI_Enemies::GetNext( AIEnemiesIter_t *pIter )
|
||||
{
|
||||
CMemMap::IndexType_t i = (CMemMap::IndexType_t)((unsigned)(*pIter));
|
||||
CMemMap::IndexType_t i = (CMemMap::IndexType_t)((uintp)(*pIter));
|
||||
|
||||
if ( i == m_Map.InvalidIndex() )
|
||||
return NULL;
|
||||
|
||||
i = m_Map.NextInorder( i );
|
||||
*pIter = (AIEnemiesIter_t)(unsigned)i;
|
||||
*pIter = (AIEnemiesIter_t)(uintp)i;
|
||||
if ( i == m_Map.InvalidIndex() )
|
||||
return NULL;
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ bool CAI_MoveSolver::Solve( const AI_MoveSuggestion_t *pSuggestions, int nSugges
|
||||
AI_MoveSuggestion_t *pHighSuggestion;
|
||||
};
|
||||
|
||||
Solution_t solutions[NUM_SOLUTIONS] = { { 0, 0, NULL } };
|
||||
Solution_t solutions[NUM_SOLUTIONS] = { 0 };
|
||||
|
||||
//---------------------------------
|
||||
|
||||
|
||||
@@ -1224,14 +1224,14 @@ AI_PathNode_t CAI_Navigator::GetNearestNode()
|
||||
#ifdef WIN32
|
||||
COMPILE_TIME_ASSERT( (int)AIN_NO_NODE == NO_NODE );
|
||||
#endif
|
||||
return (AI_PathNode_t)( GetPathfinder()->NearestNodeToNPC() );
|
||||
return (AI_PathNode_t)(intp)( GetPathfinder()->NearestNodeToNPC() );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
Vector CAI_Navigator::GetNodePos( AI_PathNode_t node )
|
||||
{
|
||||
return GetNetwork()->GetNode((int)node)->GetPosition(GetHullType());
|
||||
return GetNetwork()->GetNode((intp)node)->GetPosition(GetHullType());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -43,7 +43,7 @@ extern ConVar ai_debug_nav;
|
||||
do \
|
||||
{ \
|
||||
if (DbgNav()) \
|
||||
DevMsg( pAI, "[Nav] %s", static_cast<const char *>(pszMsg) ); \
|
||||
DevMsg( pAI, CFmtStr( "[Nav] %s", static_cast<const char *>(pszMsg) ) ); \
|
||||
} while (0)
|
||||
#define DbgNavMsg1( pAI, pszMsg, a ) DbgNavMsg( pAI, CFmtStr(static_cast<const char *>(pszMsg), (a) ) )
|
||||
#define DbgNavMsg2( pAI, pszMsg, a, b ) DbgNavMsg( pAI, CFmtStr(static_cast<const char *>(pszMsg), (a), (b) ) )
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
//
|
||||
//=============================================================================//
|
||||
|
||||
#undef sprintf
|
||||
|
||||
#include "cbase.h"
|
||||
|
||||
#include "sceneentity.h"
|
||||
@@ -548,11 +550,10 @@ void CAI_PlayerAlly::PrescheduleThink( void )
|
||||
if ( m_flNextIdleSpeechTime && m_flNextIdleSpeechTime < gpGlobals->curtime )
|
||||
{
|
||||
AISpeechSelection_t selection;
|
||||
|
||||
if ( SelectNonCombatSpeech( &selection ) )
|
||||
{
|
||||
SetSpeechTarget( selection.hSpeechTarget );
|
||||
SpeakDispatchResponse( selection.concept.c_str(), selection.Response );
|
||||
SpeakDispatchResponse( selection.concept.c_str(), selection.pResponse );
|
||||
m_flNextIdleSpeechTime = gpGlobals->curtime + RandomFloat( 20,30 );
|
||||
}
|
||||
else
|
||||
@@ -594,23 +595,22 @@ bool CAI_PlayerAlly::SelectSpeechResponse( AIConcept_t concept, const char *pszM
|
||||
{
|
||||
if ( IsAllowedToSpeak( concept ) )
|
||||
{
|
||||
bool result = SpeakFindResponse( pSelection->Response, concept, pszModifiers );
|
||||
if ( result )
|
||||
AI_Response *pResponse = SpeakFindResponse( concept, pszModifiers );
|
||||
if ( pResponse )
|
||||
{
|
||||
pSelection->concept = concept;
|
||||
pSelection->hSpeechTarget = pTarget;
|
||||
pSelection->Set( concept, pResponse, pTarget );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
void CAI_PlayerAlly::SetPendingSpeech( AIConcept_t concept, AI_Response &Response )
|
||||
void CAI_PlayerAlly::SetPendingSpeech( AIConcept_t concept, AI_Response *pResponse )
|
||||
{
|
||||
m_PendingResponse = Response;
|
||||
m_PendingResponse = *pResponse;
|
||||
pResponse->Release();
|
||||
m_PendingConcept = concept;
|
||||
m_TimePendingSet = gpGlobals->curtime;
|
||||
}
|
||||
@@ -692,7 +692,7 @@ bool CAI_PlayerAlly::SelectInterjection()
|
||||
if ( SelectIdleSpeech( &selection ) )
|
||||
{
|
||||
SetSpeechTarget( selection.hSpeechTarget );
|
||||
SpeakDispatchResponse( selection.concept.c_str(), selection.Response );
|
||||
SpeakDispatchResponse( selection.concept.c_str(), selection.pResponse );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -891,8 +891,9 @@ void CAI_PlayerAlly::AnswerQuestion( CAI_PlayerAlly *pQuestioner, int iQARandomN
|
||||
}
|
||||
}
|
||||
|
||||
Assert( selection.pResponse );
|
||||
SetSpeechTarget( selection.hSpeechTarget );
|
||||
SpeakDispatchResponse( selection.concept.c_str(), selection.Response );
|
||||
SpeakDispatchResponse( selection.concept.c_str(), selection.pResponse );
|
||||
|
||||
// Prevent idle speech for a while
|
||||
DeferAllIdleSpeech( random->RandomFloat( TALKER_DEFER_IDLE_SPEAK_MIN, TALKER_DEFER_IDLE_SPEAK_MAX ), GetSpeechTarget()->MyNPCPointer() );
|
||||
@@ -940,11 +941,11 @@ int CAI_PlayerAlly::SelectNonCombatSpeechSchedule()
|
||||
if ( !HasPendingSpeech() )
|
||||
{
|
||||
AISpeechSelection_t selection;
|
||||
|
||||
if ( SelectNonCombatSpeech( &selection ) )
|
||||
{
|
||||
Assert( selection.pResponse );
|
||||
SetSpeechTarget( selection.hSpeechTarget );
|
||||
SetPendingSpeech( selection.concept.c_str(), selection.Response );
|
||||
SetPendingSpeech( selection.concept.c_str(), selection.pResponse );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1019,14 +1020,14 @@ void CAI_PlayerAlly::StartTask( const Task_t *pTask )
|
||||
case TASK_TALKER_SPEAK_PENDING:
|
||||
if ( !m_PendingConcept.empty() )
|
||||
{
|
||||
SpeakDispatchResponse( m_PendingConcept.c_str(), m_PendingResponse );
|
||||
AI_Response *pResponse = new AI_Response;
|
||||
*pResponse = m_PendingResponse;
|
||||
SpeakDispatchResponse( m_PendingConcept.c_str(), pResponse );
|
||||
m_PendingConcept.erase();
|
||||
TaskComplete();
|
||||
}
|
||||
else
|
||||
{
|
||||
TaskFail( FAIL_NO_SOUND );
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1693,15 +1694,15 @@ bool CAI_PlayerAlly::RespondedTo( const char *ResponseConcept, bool bForce, bool
|
||||
{
|
||||
// We're being forced to respond to the event, probably because it's the
|
||||
// player dying or something equally important.
|
||||
AI_Response response;
|
||||
bool result = SpeakFindResponse( response, ResponseConcept, NULL );
|
||||
AI_Response *result = SpeakFindResponse( ResponseConcept, NULL );
|
||||
if ( result )
|
||||
{
|
||||
// We've got something to say. Stop any scenes we're in, and speak the response.
|
||||
if ( bCancelScene )
|
||||
RemoveActorFromScriptedScenes( this, false );
|
||||
|
||||
return SpeakDispatchResponse( ResponseConcept, response );
|
||||
bool spoke = SpeakDispatchResponse( ResponseConcept, result );
|
||||
return spoke;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -248,9 +248,21 @@ enum AISpeechTargetSearchFlags_t
|
||||
|
||||
struct AISpeechSelection_t
|
||||
{
|
||||
std::string concept;
|
||||
AI_Response Response;
|
||||
EHANDLE hSpeechTarget;
|
||||
AISpeechSelection_t()
|
||||
: pResponse(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
void Set( AIConcept_t newConcept, AI_Response *pNewResponse, CBaseEntity *pTarget = NULL )
|
||||
{
|
||||
pResponse = pNewResponse;
|
||||
concept = newConcept;
|
||||
hSpeechTarget = pTarget;
|
||||
}
|
||||
|
||||
std::string concept;
|
||||
AI_Response * pResponse;
|
||||
EHANDLE hSpeechTarget;
|
||||
};
|
||||
|
||||
//-------------------------------------
|
||||
@@ -335,7 +347,7 @@ public:
|
||||
//---------------------------------
|
||||
|
||||
bool SelectSpeechResponse( AIConcept_t concept, const char *pszModifiers, CBaseEntity *pTarget, AISpeechSelection_t *pSelection );
|
||||
void SetPendingSpeech( AIConcept_t concept, AI_Response &Response );
|
||||
void SetPendingSpeech( AIConcept_t concept, AI_Response *pResponse );
|
||||
void ClearPendingSpeech();
|
||||
bool HasPendingSpeech() { return !m_PendingConcept.empty(); }
|
||||
|
||||
|
||||
@@ -49,6 +49,9 @@ struct AISightIterVal_t
|
||||
char array;
|
||||
short iNext;
|
||||
char SeenArray;
|
||||
#ifdef PLATFORM_64BITS
|
||||
uint32 unused;
|
||||
#endif
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
@@ -272,7 +275,7 @@ CBaseEntity *CAI_Senses::GetFirstSeenEntity( AISightIter_t *pIter, seentype_t iS
|
||||
|
||||
CBaseEntity *CAI_Senses::GetNextSeenEntity( AISightIter_t *pIter ) const
|
||||
{
|
||||
if ( ((int)*pIter) != -1 )
|
||||
if ( ((intp)*pIter) != -1 )
|
||||
{
|
||||
AISightIterVal_t *pIterVal = (AISightIterVal_t *)pIter;
|
||||
|
||||
@@ -570,7 +573,7 @@ CSound* CAI_Senses::GetFirstHeardSound( AISoundIter_t *pIter )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*pIter = (AISoundIter_t)iFirst;
|
||||
*pIter = (AISoundIter_t)(intp)iFirst;
|
||||
return CSoundEnt::SoundPointerForIndex( iFirst );
|
||||
}
|
||||
|
||||
@@ -581,7 +584,7 @@ CSound* CAI_Senses::GetNextHeardSound( AISoundIter_t *pIter )
|
||||
if ( !*pIter )
|
||||
return NULL;
|
||||
|
||||
int iCurrent = (int)*pIter;
|
||||
intp iCurrent = (intp)*pIter;
|
||||
|
||||
Assert( iCurrent != SOUNDLIST_EMPTY );
|
||||
if ( iCurrent == SOUNDLIST_EMPTY )
|
||||
|
||||
+148
-90
@@ -38,7 +38,10 @@ CAI_TimedSemaphore g_AIFoesTalkSemaphore;
|
||||
|
||||
ConceptHistory_t::~ConceptHistory_t()
|
||||
{
|
||||
delete response;
|
||||
if ( response )
|
||||
{
|
||||
delete response;
|
||||
}
|
||||
response = NULL;
|
||||
}
|
||||
|
||||
@@ -54,16 +57,14 @@ ConceptHistory_t::ConceptHistory_t( const ConceptHistory_t& src )
|
||||
|
||||
ConceptHistory_t& ConceptHistory_t::operator =( const ConceptHistory_t& src )
|
||||
{
|
||||
if ( this != &src )
|
||||
{
|
||||
timeSpoken = src.timeSpoken;
|
||||
if ( this == &src )
|
||||
return *this;
|
||||
|
||||
delete response;
|
||||
response = NULL;
|
||||
if ( src.response )
|
||||
{
|
||||
response = new AI_Response( *src.response );
|
||||
}
|
||||
timeSpoken = src.timeSpoken;
|
||||
response = NULL;
|
||||
if ( src.response )
|
||||
{
|
||||
response = new AI_Response( *src.response );
|
||||
}
|
||||
|
||||
return *this;
|
||||
@@ -88,14 +89,14 @@ public:
|
||||
|
||||
pSave->StartBlock();
|
||||
{
|
||||
|
||||
// Write element name
|
||||
pSave->WriteString( ch->GetElementName( i ) );
|
||||
|
||||
// Write data
|
||||
pSave->WriteAll( pHistory );
|
||||
|
||||
// Write response blob
|
||||
bool hasresponse = !!pHistory->response;
|
||||
bool hasresponse = pHistory->response != NULL ? true : false;
|
||||
pSave->WriteBool( &hasresponse );
|
||||
if ( hasresponse )
|
||||
{
|
||||
@@ -117,7 +118,6 @@ public:
|
||||
{
|
||||
char conceptname[ 512 ];
|
||||
conceptname[ 0 ] = 0;
|
||||
|
||||
ConceptHistory_t history;
|
||||
|
||||
pRestore->StartBlock();
|
||||
@@ -127,6 +127,7 @@ public:
|
||||
pRestore->ReadAll( &history );
|
||||
|
||||
bool hasresponse = false;
|
||||
|
||||
pRestore->ReadBool( &hasresponse );
|
||||
if ( hasresponse )
|
||||
{
|
||||
@@ -150,7 +151,7 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
virtual void MakeEmpty( const SaveRestoreFieldInfo_t &fieldInfo )
|
||||
{
|
||||
}
|
||||
@@ -250,14 +251,14 @@ void CAI_Expresser::TestAllResponses()
|
||||
if ( pResponseSystem )
|
||||
{
|
||||
CUtlVector<AI_Response *> responses;
|
||||
|
||||
pResponseSystem->GetAllResponses( &responses );
|
||||
for ( int i = 0; i < responses.Count(); i++ )
|
||||
{
|
||||
const char *szResponse = responses[i]->GetResponsePtr();
|
||||
char response[ 256 ];
|
||||
responses[i]->GetResponse( response, sizeof( response ) );
|
||||
|
||||
Msg( "Response: %s\n", szResponse );
|
||||
SpeakDispatchResponse( "", *responses[i] );
|
||||
Msg( "Response: %s\n", response );
|
||||
SpeakDispatchResponse( "", responses[i] );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -272,13 +273,13 @@ static const int LEN_SPECIFIC_SCENE_MODIFIER = strlen( AI_SPECIFIC_SCENE_MODIFIE
|
||||
// NULL -
|
||||
// Output : AI_Response
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CAI_Expresser::SpeakFindResponse( AI_Response &outResponse, AIConcept_t concept, const char *modifiers /*= NULL*/ )
|
||||
AI_Response *CAI_Expresser::SpeakFindResponse( AIConcept_t concept, const char *modifiers /*= NULL*/ )
|
||||
{
|
||||
IResponseSystem *rs = GetOuter()->GetResponseSystem();
|
||||
if ( !rs )
|
||||
{
|
||||
Assert( !"No response system installed for CAI_Expresser::GetOuter()!!!" );
|
||||
return false;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
AI_CriteriaSet set;
|
||||
@@ -286,7 +287,7 @@ bool CAI_Expresser::SpeakFindResponse( AI_Response &outResponse, AIConcept_t con
|
||||
set.AppendCriteria( "concept", concept, CONCEPT_WEIGHT );
|
||||
|
||||
// Always include any optional modifiers
|
||||
if ( modifiers )
|
||||
if ( modifiers != NULL )
|
||||
{
|
||||
char copy_modifiers[ 255 ];
|
||||
const char *pCopy;
|
||||
@@ -319,19 +320,30 @@ bool CAI_Expresser::SpeakFindResponse( AI_Response &outResponse, AIConcept_t con
|
||||
}
|
||||
|
||||
// Now that we have a criteria set, ask for a suitable response
|
||||
bool found = rs->FindBestResponse( set, outResponse, this );
|
||||
AI_Response *result = new AI_Response;
|
||||
Assert( result && "new AI_Response: Returned a NULL AI_Response!" );
|
||||
bool found = rs->FindBestResponse( set, *result, this );
|
||||
|
||||
if ( rr_debugresponses.GetInt() == 3 )
|
||||
{
|
||||
if ( ( GetOuter()->MyNPCPointer() && GetOuter()->m_debugOverlays & OVERLAY_NPC_SELECTED_BIT ) || GetOuter()->IsPlayer() )
|
||||
{
|
||||
const char *pszName = GetOuter()->IsPlayer() ?
|
||||
((CBasePlayer*)GetOuter())->GetPlayerName() : GetOuter()->GetDebugName();
|
||||
const char *pszName;
|
||||
if ( GetOuter()->IsPlayer() )
|
||||
{
|
||||
pszName = ((CBasePlayer*)GetOuter())->GetPlayerName();
|
||||
}
|
||||
else
|
||||
{
|
||||
pszName = GetOuter()->GetDebugName();
|
||||
}
|
||||
|
||||
if ( found )
|
||||
{
|
||||
const char *szReponse = outResponse.GetResponsePtr();
|
||||
Warning( "RESPONSERULES: %s spoke '%s'. Found response '%s'.\n", pszName, concept, szReponse );
|
||||
char response[ 256 ];
|
||||
result->GetResponse( response, sizeof( response ) );
|
||||
|
||||
Warning( "RESPONSERULES: %s spoke '%s'. Found response '%s'.\n", pszName, concept, response );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -341,28 +353,44 @@ bool CAI_Expresser::SpeakFindResponse( AI_Response &outResponse, AIConcept_t con
|
||||
}
|
||||
|
||||
if ( !found )
|
||||
return false;
|
||||
{
|
||||
//Assert( !"rs->FindBestResponse: Returned a NULL AI_Response!" );
|
||||
delete result;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *szReponse = outResponse.GetResponsePtr();
|
||||
if ( !szReponse[0] )
|
||||
return false;
|
||||
char response[ 256 ];
|
||||
result->GetResponse( response, sizeof( response ) );
|
||||
|
||||
if ( ( outResponse.GetOdds() < 100 ) && ( random->RandomInt( 1, 100 ) <= outResponse.GetOdds() ) )
|
||||
return false;
|
||||
if ( !response[0] )
|
||||
{
|
||||
delete result;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return true;
|
||||
if ( result->GetOdds() < 100 && random->RandomInt( 1, 100 ) <= result->GetOdds() )
|
||||
{
|
||||
delete result;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Dispatches the result
|
||||
// Input : *response -
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response& response, IRecipientFilter *filter /* = NULL */ )
|
||||
bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response *result, IRecipientFilter *filter /* = NULL */ )
|
||||
{
|
||||
char response[ 256 ];
|
||||
result->GetResponse( response, sizeof( response ) );
|
||||
|
||||
float delay = result->GetDelay();
|
||||
|
||||
bool spoke = false;
|
||||
float delay = response.GetDelay();
|
||||
const char *szResponse = response.GetResponsePtr();
|
||||
soundlevel_t soundlevel = response.GetSoundLevel();
|
||||
|
||||
soundlevel_t soundlevel = result->GetSoundLevel();
|
||||
|
||||
if ( IsSpeaking() && concept[0] != 0 )
|
||||
{
|
||||
@@ -376,52 +404,63 @@ bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response& res
|
||||
if ( IsRunningScriptedScene( GetOuter() ) )
|
||||
{
|
||||
DevMsg( "SpeakDispatchResponse: Entity ( %i/%s ) refusing to speak due to scene entity, tossing '%s'\n", GetOuter()->entindex(), STRING( GetOuter()->GetEntityName() ), concept );
|
||||
delete result;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
switch ( response.GetType() )
|
||||
switch ( result->GetType() )
|
||||
{
|
||||
default:
|
||||
case RESPONSE_NONE:
|
||||
break;
|
||||
|
||||
case RESPONSE_SPEAK:
|
||||
if ( !response.ShouldntUseScene() )
|
||||
{
|
||||
// This generates a fake CChoreoScene wrapping the sound.txt name
|
||||
spoke = SpeakAutoGeneratedScene( szResponse, delay );
|
||||
}
|
||||
else
|
||||
{
|
||||
float speakTime = GetResponseDuration( response );
|
||||
GetOuter()->EmitSound( szResponse );
|
||||
if ( !result->ShouldntUseScene() )
|
||||
{
|
||||
// This generates a fake CChoreoScene wrapping the sound.txt name
|
||||
spoke = SpeakAutoGeneratedScene( response, delay );
|
||||
}
|
||||
else
|
||||
{
|
||||
float speakTime = GetResponseDuration( result );
|
||||
GetOuter()->EmitSound( response );
|
||||
|
||||
DevMsg( "SpeakDispatchResponse: Entity ( %i/%s ) playing sound '%s'\n", GetOuter()->entindex(), STRING( GetOuter()->GetEntityName() ), szResponse );
|
||||
NoteSpeaking( speakTime, delay );
|
||||
spoke = true;
|
||||
DevMsg( "SpeakDispatchResponse: Entity ( %i/%s ) playing sound '%s'\n", GetOuter()->entindex(), STRING( GetOuter()->GetEntityName() ), response );
|
||||
NoteSpeaking( speakTime, delay );
|
||||
spoke = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case RESPONSE_SENTENCE:
|
||||
spoke = ( -1 != SpeakRawSentence( szResponse, delay, VOL_NORM, soundlevel ) ) ? true : false;
|
||||
{
|
||||
spoke = ( -1 != SpeakRawSentence( response, delay, VOL_NORM, soundlevel ) ) ? true : false;
|
||||
}
|
||||
break;
|
||||
|
||||
case RESPONSE_SCENE:
|
||||
spoke = SpeakRawScene( szResponse, delay, &response, filter );
|
||||
{
|
||||
spoke = SpeakRawScene( response, delay, result, filter );
|
||||
}
|
||||
break;
|
||||
|
||||
case RESPONSE_RESPONSE:
|
||||
// This should have been recursively resolved already
|
||||
Assert( 0 );
|
||||
{
|
||||
// This should have been recursively resolved already
|
||||
Assert( 0 );
|
||||
}
|
||||
break;
|
||||
case RESPONSE_PRINT:
|
||||
if ( g_pDeveloper->GetInt() > 0 )
|
||||
{
|
||||
Vector vPrintPos;
|
||||
GetOuter()->CollisionProp()->NormalizedToWorldSpace( Vector(0.5,0.5,1.0f), &vPrintPos );
|
||||
NDebugOverlay::Text( vPrintPos, szResponse, true, 1.5 );
|
||||
spoke = true;
|
||||
if ( g_pDeveloper->GetInt() > 0 )
|
||||
{
|
||||
Vector vPrintPos;
|
||||
GetOuter()->CollisionProp()->NormalizedToWorldSpace( Vector(0.5,0.5,1.0f), &vPrintPos );
|
||||
NDebugOverlay::Text( vPrintPos, response, true, 1.5 );
|
||||
spoke = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -429,27 +468,30 @@ bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response& res
|
||||
if ( spoke )
|
||||
{
|
||||
m_flLastTimeAcceptedSpeak = gpGlobals->curtime;
|
||||
if ( DebuggingSpeech() && g_pDeveloper->GetInt() > 0 && response.GetType() != RESPONSE_PRINT )
|
||||
if ( DebuggingSpeech() && g_pDeveloper->GetInt() > 0 && response && result->GetType() != RESPONSE_PRINT )
|
||||
{
|
||||
Vector vPrintPos;
|
||||
GetOuter()->CollisionProp()->NormalizedToWorldSpace( Vector(0.5,0.5,1.0f), &vPrintPos );
|
||||
NDebugOverlay::Text( vPrintPos, CFmtStr( "%s: %s", concept, szResponse ), true, 1.5 );
|
||||
NDebugOverlay::Text( vPrintPos, CFmtStr( "%s: %s", concept, response ), true, 1.5 );
|
||||
}
|
||||
|
||||
if ( response.IsApplyContextToWorld() )
|
||||
if ( result->IsApplyContextToWorld() )
|
||||
{
|
||||
CBaseEntity *pEntity = CBaseEntity::Instance( engine->PEntityOfEntIndex( 0 ) );
|
||||
if ( pEntity )
|
||||
{
|
||||
pEntity->AddContext( response.GetContext() );
|
||||
pEntity->AddContext( result->GetContext() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GetOuter()->AddContext( response.GetContext() );
|
||||
GetOuter()->AddContext( result->GetContext() );
|
||||
}
|
||||
|
||||
SetSpokeConcept( concept, &response );
|
||||
SetSpokeConcept( concept, result );
|
||||
}
|
||||
else
|
||||
{
|
||||
delete result;
|
||||
}
|
||||
|
||||
return spoke;
|
||||
@@ -460,33 +502,44 @@ bool CAI_Expresser::SpeakDispatchResponse( AIConcept_t concept, AI_Response& res
|
||||
// Input : *response -
|
||||
// Output : float
|
||||
//-----------------------------------------------------------------------------
|
||||
float CAI_Expresser::GetResponseDuration( AI_Response& response )
|
||||
float CAI_Expresser::GetResponseDuration( AI_Response *result )
|
||||
{
|
||||
const char *szResponse = response.GetResponsePtr();
|
||||
Assert( result );
|
||||
char response[ 256 ];
|
||||
result->GetResponse( response, sizeof( response ) );
|
||||
|
||||
switch ( response.GetType() )
|
||||
switch ( result->GetType() )
|
||||
{
|
||||
default:
|
||||
case RESPONSE_NONE:
|
||||
break;
|
||||
|
||||
case RESPONSE_SPEAK:
|
||||
return GetOuter()->GetSoundDuration( szResponse, STRING( GetOuter()->GetModelName() ) );
|
||||
|
||||
{
|
||||
return GetOuter()->GetSoundDuration( response, STRING( GetOuter()->GetModelName() ) );
|
||||
}
|
||||
break;
|
||||
case RESPONSE_SENTENCE:
|
||||
Assert( 0 );
|
||||
return 999.0f;
|
||||
|
||||
{
|
||||
Assert( 0 );
|
||||
return 999.0f;
|
||||
}
|
||||
break;
|
||||
case RESPONSE_SCENE:
|
||||
return GetSceneDuration( szResponse );
|
||||
|
||||
{
|
||||
return GetSceneDuration( response );
|
||||
}
|
||||
break;
|
||||
case RESPONSE_RESPONSE:
|
||||
// This should have been recursively resolved already
|
||||
Assert( 0 );
|
||||
{
|
||||
// This should have been recursively resolved already
|
||||
Assert( 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case RESPONSE_PRINT:
|
||||
return 1.0;
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 0.0f;
|
||||
@@ -499,18 +552,18 @@ float CAI_Expresser::GetResponseDuration( AI_Response& response )
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CAI_Expresser::Speak( AIConcept_t concept, const char *modifiers /*= NULL*/, char *pszOutResponseChosen /* = NULL*/, size_t bufsize /* = 0 */, IRecipientFilter *filter /* = NULL */ )
|
||||
{
|
||||
AI_Response response;
|
||||
bool result = SpeakFindResponse( response, concept, modifiers );
|
||||
AI_Response *result = SpeakFindResponse( concept, modifiers );
|
||||
if ( !result )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
SpeechMsg( GetOuter(), "%s (%p) spoke %s (%f)\n", STRING(GetOuter()->GetEntityName()), GetOuter(), concept, gpGlobals->curtime );
|
||||
|
||||
bool spoke = SpeakDispatchResponse( concept, response, filter );
|
||||
bool spoke = SpeakDispatchResponse( concept, result, filter );
|
||||
if ( pszOutResponseChosen )
|
||||
{
|
||||
const char *szResponse = response.GetResponsePtr();
|
||||
Q_strncpy( pszOutResponseChosen, szResponse, bufsize );
|
||||
result->GetResponse( pszOutResponseChosen, bufsize );
|
||||
}
|
||||
|
||||
return spoke;
|
||||
@@ -755,12 +808,17 @@ void CAI_Expresser::SetSpokeConcept( AIConcept_t concept, AI_Response *response,
|
||||
ConceptHistory_t *slot = &m_ConceptHistories[ idx ];
|
||||
|
||||
slot->timeSpoken = gpGlobals->curtime;
|
||||
|
||||
// Update response info
|
||||
if ( response )
|
||||
{
|
||||
delete slot->response;
|
||||
slot->response = new AI_Response( *response );
|
||||
AI_Response *r = slot->response;
|
||||
if ( r )
|
||||
{
|
||||
delete r;
|
||||
}
|
||||
|
||||
// FIXME: Are we leaking AI_Responses?
|
||||
slot->response = response;
|
||||
}
|
||||
|
||||
if ( bCallback )
|
||||
@@ -827,13 +885,13 @@ void CAI_Expresser::SpeechMsg( CBaseEntity *pFlex, const char *pszFormat, ... )
|
||||
|
||||
if ( pFlex->MyNPCPointer() )
|
||||
{
|
||||
DevMsg( pFlex->MyNPCPointer(), "%s", string );
|
||||
DevMsg( pFlex->MyNPCPointer(), string );
|
||||
}
|
||||
else
|
||||
{
|
||||
DevMsg( "%s", string );
|
||||
}
|
||||
UTIL_LogPrintf( "%s", string );
|
||||
UTIL_LogPrintf( string );
|
||||
}
|
||||
|
||||
|
||||
|
||||
+12
-12
@@ -135,7 +135,7 @@ struct ConceptHistory_t
|
||||
ConceptHistory_t& operator = ( const ConceptHistory_t& src );
|
||||
|
||||
~ConceptHistory_t();
|
||||
|
||||
|
||||
float timeSpoken;
|
||||
AI_Response *response;
|
||||
};
|
||||
@@ -159,9 +159,9 @@ public:
|
||||
bool Speak( AIConcept_t concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL );
|
||||
|
||||
// These two methods allow looking up a response and dispatching it to be two different steps
|
||||
bool SpeakFindResponse( AI_Response &response, AIConcept_t concept, const char *modifiers = NULL );
|
||||
bool SpeakDispatchResponse( AIConcept_t concept, AI_Response &response, IRecipientFilter *filter = NULL );
|
||||
float GetResponseDuration( AI_Response &response );
|
||||
AI_Response *SpeakFindResponse( AIConcept_t concept, const char *modifiers = NULL );
|
||||
bool SpeakDispatchResponse( AIConcept_t concept, AI_Response *response, IRecipientFilter *filter = NULL );
|
||||
float GetResponseDuration( AI_Response *response );
|
||||
|
||||
virtual int SpeakRawSentence( const char *pszSentence, float delay, float volume = VOL_NORM, soundlevel_t soundlevel = SNDLVL_TALKING, CBaseEntity *pListener = NULL );
|
||||
|
||||
@@ -283,10 +283,10 @@ public:
|
||||
virtual bool Speak( AIConcept_t concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL );
|
||||
|
||||
// These two methods allow looking up a response and dispatching it to be two different steps
|
||||
bool SpeakFindResponse( AI_Response& response, AIConcept_t concept, const char *modifiers = NULL );
|
||||
bool SpeakDispatchResponse( AIConcept_t concept, AI_Response& response );
|
||||
virtual void PostSpeakDispatchResponse( AIConcept_t concept, AI_Response& response ) { return; }
|
||||
float GetResponseDuration( AI_Response& response );
|
||||
AI_Response * SpeakFindResponse( AIConcept_t concept, const char *modifiers = NULL );
|
||||
bool SpeakDispatchResponse( AIConcept_t concept, AI_Response *response );
|
||||
virtual void PostSpeakDispatchResponse( AIConcept_t concept, AI_Response *response ) { return; }
|
||||
float GetResponseDuration( AI_Response *response );
|
||||
|
||||
float GetTimeSpeechComplete() const { return this->GetExpresser()->GetTimeSpeechComplete(); }
|
||||
|
||||
@@ -360,15 +360,15 @@ inline IResponseSystem *CAI_ExpresserHost<BASE_NPC>::GetResponseSystem()
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
template <class BASE_NPC>
|
||||
inline bool CAI_ExpresserHost<BASE_NPC>::SpeakFindResponse( AI_Response& response, AIConcept_t concept, const char *modifiers /*= NULL*/ )
|
||||
inline AI_Response *CAI_ExpresserHost<BASE_NPC>::SpeakFindResponse( AIConcept_t concept, const char *modifiers /*= NULL*/ )
|
||||
{
|
||||
return this->GetExpresser()->SpeakFindResponse( response, concept, modifiers );
|
||||
return this->GetExpresser()->SpeakFindResponse( concept, modifiers );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
template <class BASE_NPC>
|
||||
inline bool CAI_ExpresserHost<BASE_NPC>::SpeakDispatchResponse( AIConcept_t concept, AI_Response& response )
|
||||
inline bool CAI_ExpresserHost<BASE_NPC>::SpeakDispatchResponse( AIConcept_t concept, AI_Response *response )
|
||||
{
|
||||
if ( this->GetExpresser()->SpeakDispatchResponse( concept, response ) )
|
||||
{
|
||||
@@ -382,7 +382,7 @@ inline bool CAI_ExpresserHost<BASE_NPC>::SpeakDispatchResponse( AIConcept_t conc
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
template <class BASE_NPC>
|
||||
inline float CAI_ExpresserHost<BASE_NPC>::GetResponseDuration( AI_Response& response )
|
||||
inline float CAI_ExpresserHost<BASE_NPC>::GetResponseDuration( AI_Response *response )
|
||||
{
|
||||
return this->GetExpresser()->GetResponseDuration( response );
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ END_DATADESC()
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
CAI_Squad::CAI_Squad(string_t newName)
|
||||
CAI_Squad::CAI_Squad(string_t newName)
|
||||
#ifndef PER_ENEMY_SQUADSLOTS
|
||||
: m_squadSlotsUsed(MAX_SQUADSLOTS)
|
||||
#endif
|
||||
@@ -163,7 +163,7 @@ CAI_Squad::CAI_Squad(string_t newName)
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
CAI_Squad::CAI_Squad()
|
||||
CAI_Squad::CAI_Squad()
|
||||
#ifndef PER_ENEMY_SQUADSLOTS
|
||||
: m_squadSlotsUsed(MAX_SQUADSLOTS)
|
||||
#endif
|
||||
@@ -175,7 +175,7 @@ CAI_Squad::CAI_Squad()
|
||||
|
||||
void CAI_Squad::Init(string_t newName)
|
||||
{
|
||||
m_Name = AllocPooledString( STRING(newName) );
|
||||
m_Name = newName;
|
||||
m_pNextSquad = NULL;
|
||||
m_flSquadSoundWaitTime = 0;
|
||||
m_SquadMembers.RemoveAll();
|
||||
@@ -420,7 +420,7 @@ CAI_BaseNPC *CAI_Squad::GetLeader( void )
|
||||
//-----------------------------------------------------------------------------
|
||||
CAI_BaseNPC *CAI_Squad::GetFirstMember( AISquadIter_t *pIter, bool bIgnoreSilentMembers )
|
||||
{
|
||||
int i = 0;
|
||||
intp i = 0;
|
||||
if ( bIgnoreSilentMembers )
|
||||
{
|
||||
for ( ; i < m_SquadMembers.Count(); i++ )
|
||||
|
||||
@@ -49,7 +49,7 @@ const char *TaskFailureToString( AI_TaskFailureCode_t code )
|
||||
{
|
||||
const char *pszResult;
|
||||
if ( code < 0 || code >= NUM_FAIL_CODES )
|
||||
pszResult = (const char *)code;
|
||||
pszResult = (const char *)(intp)code;
|
||||
else
|
||||
pszResult = g_ppszTaskFailureText[code];
|
||||
return pszResult;
|
||||
|
||||
@@ -23,7 +23,7 @@ class CStringRegistry;
|
||||
// Codes are either one of the enumerated types below, or a string (similar to Windows resource IDs)
|
||||
typedef int AI_TaskFailureCode_t;
|
||||
|
||||
enum AI_BaseTaskFailureCodes_t
|
||||
enum AI_BaseTaskFailureCodes_t : AI_TaskFailureCode_t
|
||||
{
|
||||
NO_TASK_FAILURE,
|
||||
FAIL_NO_TARGET,
|
||||
@@ -63,7 +63,7 @@ inline bool IsPathTaskFailure( AI_TaskFailureCode_t code )
|
||||
}
|
||||
|
||||
const char *TaskFailureToString( AI_TaskFailureCode_t code );
|
||||
inline int MakeFailCode( const char *pszGeneralError ) { return (int)pszGeneralError; }
|
||||
inline intp MakeFailCode( const char *pszGeneralError ) { return (intp)pszGeneralError; }
|
||||
|
||||
|
||||
enum TaskStatus_e
|
||||
|
||||
@@ -1026,9 +1026,6 @@ void CAI_TrackPather::UpdateCurrentTargetLeading()
|
||||
bool bRestingAtDest = false;
|
||||
CPathTrack *pAdjustedDest;
|
||||
|
||||
if( !m_pCurrentPathTarget )
|
||||
return;
|
||||
|
||||
// Find the point along the line that we're closest to.
|
||||
const Vector &vecTarget = m_pCurrentPathTarget->GetAbsOrigin();
|
||||
Vector vecPoint;
|
||||
|
||||
@@ -470,6 +470,7 @@ void CBaseAnimating::StudioFrameAdvanceManual( float flInterval )
|
||||
if ( !pStudioHdr )
|
||||
return;
|
||||
|
||||
UpdateModelScale();
|
||||
m_flAnimTime = gpGlobals->curtime;
|
||||
m_flPrevAnimTime = m_flAnimTime - flInterval;
|
||||
float flCycleRate = GetSequenceCycleRate( pStudioHdr, GetSequence() ) * m_flPlaybackRate;
|
||||
@@ -489,6 +490,8 @@ void CBaseAnimating::StudioFrameAdvance()
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateModelScale();
|
||||
|
||||
if ( !m_flPrevAnimTime )
|
||||
{
|
||||
m_flPrevAnimTime = m_flAnimTime;
|
||||
@@ -628,7 +631,7 @@ void CBaseAnimating::InputSetModelScale( inputdata_t &inputdata )
|
||||
int CBaseAnimating::SelectWeightedSequence ( Activity activity )
|
||||
{
|
||||
Assert( activity != ACT_INVALID );
|
||||
AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
|
||||
Assert( GetModelPtr() );
|
||||
return ::SelectWeightedSequence( GetModelPtr(), activity, GetSequence() );
|
||||
}
|
||||
|
||||
@@ -636,23 +639,16 @@ int CBaseAnimating::SelectWeightedSequence ( Activity activity )
|
||||
int CBaseAnimating::SelectWeightedSequence ( Activity activity, int curSequence )
|
||||
{
|
||||
Assert( activity != ACT_INVALID );
|
||||
AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
|
||||
Assert( GetModelPtr() );
|
||||
return ::SelectWeightedSequence( GetModelPtr(), activity, curSequence );
|
||||
}
|
||||
|
||||
int CBaseAnimating::SelectWeightedSequenceFromModifiers( Activity activity, CUtlSymbol *pActivityModifiers, int iModifierCount )
|
||||
{
|
||||
Assert( activity != ACT_INVALID );
|
||||
AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
|
||||
return GetModelPtr()->SelectWeightedSequenceFromModifiers( activity, pActivityModifiers, iModifierCount );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
// ResetActivityIndexes
|
||||
//=========================================================
|
||||
void CBaseAnimating::ResetActivityIndexes ( void )
|
||||
{
|
||||
AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
|
||||
Assert( GetModelPtr() );
|
||||
::ResetActivityIndexes( GetModelPtr() );
|
||||
}
|
||||
|
||||
@@ -661,7 +657,7 @@ void CBaseAnimating::ResetActivityIndexes ( void )
|
||||
//=========================================================
|
||||
void CBaseAnimating::ResetEventIndexes ( void )
|
||||
{
|
||||
AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
|
||||
Assert( GetModelPtr() );
|
||||
::ResetEventIndexes( GetModelPtr() );
|
||||
}
|
||||
|
||||
@@ -673,7 +669,7 @@ void CBaseAnimating::ResetEventIndexes ( void )
|
||||
//=========================================================
|
||||
int CBaseAnimating::SelectHeaviestSequence ( Activity activity )
|
||||
{
|
||||
AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
|
||||
Assert( GetModelPtr() );
|
||||
return ::SelectHeaviestSequence( GetModelPtr(), activity );
|
||||
}
|
||||
|
||||
@@ -685,7 +681,7 @@ int CBaseAnimating::SelectHeaviestSequence ( Activity activity )
|
||||
//-----------------------------------------------------------------------------
|
||||
int CBaseAnimating::LookupActivity( const char *label )
|
||||
{
|
||||
AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
|
||||
Assert( GetModelPtr() );
|
||||
return ::LookupActivity( GetModelPtr(), label );
|
||||
}
|
||||
|
||||
@@ -693,7 +689,7 @@ int CBaseAnimating::LookupActivity( const char *label )
|
||||
//=========================================================
|
||||
int CBaseAnimating::LookupSequence( const char *label )
|
||||
{
|
||||
AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
|
||||
Assert( GetModelPtr() );
|
||||
return ::LookupSequence( GetModelPtr(), label );
|
||||
}
|
||||
|
||||
@@ -733,7 +729,7 @@ float CBaseAnimating::GetSequenceMoveYaw( int iSequence )
|
||||
{
|
||||
Vector vecReturn;
|
||||
|
||||
AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
|
||||
Assert( GetModelPtr() );
|
||||
::GetSequenceLinearMotion( GetModelPtr(), iSequence, GetPoseParameterArray(), &vecReturn );
|
||||
|
||||
if (vecReturn.Length() > 0)
|
||||
@@ -769,7 +765,7 @@ float CBaseAnimating::GetSequenceMoveDist( CStudioHdr *pStudioHdr, int iSequence
|
||||
//-----------------------------------------------------------------------------
|
||||
void CBaseAnimating::GetSequenceLinearMotion( int iSequence, Vector *pVec )
|
||||
{
|
||||
AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
|
||||
Assert( GetModelPtr() );
|
||||
::GetSequenceLinearMotion( GetModelPtr(), iSequence, GetPoseParameterArray(), pVec );
|
||||
}
|
||||
|
||||
@@ -916,7 +912,7 @@ void CBaseAnimating::ResetSequenceInfo ( )
|
||||
//=========================================================
|
||||
bool CBaseAnimating::IsValidSequence( int iSequence )
|
||||
{
|
||||
AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
|
||||
Assert( GetModelPtr() );
|
||||
CStudioHdr* pstudiohdr = GetModelPtr( );
|
||||
if (iSequence < 0 || iSequence >= pstudiohdr->GetNumSeq())
|
||||
{
|
||||
@@ -959,11 +955,14 @@ float CBaseAnimating::GetSequenceCycleRate( CStudioHdr *pStudioHdr, int iSequenc
|
||||
{
|
||||
float t = SequenceDuration( pStudioHdr, iSequence );
|
||||
|
||||
if ( t != 0.0f )
|
||||
if (t > 0.0f)
|
||||
{
|
||||
return 1.0f / t;
|
||||
}
|
||||
return t;
|
||||
else
|
||||
{
|
||||
return 1.0f / 0.1f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1633,12 +1632,9 @@ void CBaseAnimating::CalculateIKLocks( float currentTime )
|
||||
enginetrace->TraceRay( ray, MASK_SOLID, &traceFilter, &trace );
|
||||
|
||||
/*
|
||||
if ( debugoverlay )
|
||||
{
|
||||
debugoverlay->AddBoxOverlay( p1, Vector(-r,-r,0), Vector(r,r,1), QAngle( 0, 0, 0 ), 255, 0, 0, 0, 1.0f );
|
||||
debugoverlay->AddBoxOverlay( trace.endpos, Vector(-r,-r,0), Vector(r,r,1), QAngle( 0, 0, 0 ), 255, 0, 0, 0, 1.0f );
|
||||
debugoverlay->AddLineOverlay( p1, trace.endpos, 255, 0, 0, 0, 1.0f );
|
||||
}
|
||||
debugoverlay->AddBoxOverlay( p1, Vector(-r,-r,0), Vector(r,r,1), QAngle( 0, 0, 0 ), 255, 0, 0, 0, 1.0f );
|
||||
debugoverlay->AddBoxOverlay( trace.endpos, Vector(-r,-r,0), Vector(r,r,1), QAngle( 0, 0, 0 ), 255, 0, 0, 0, 1.0f );
|
||||
debugoverlay->AddLineOverlay( p1, trace.endpos, 255, 0, 0, 0, 1.0f );
|
||||
*/
|
||||
|
||||
if (trace.startsolid)
|
||||
@@ -1783,7 +1779,7 @@ void CBaseAnimating::SetupBones( matrix3x4_t *pBoneToWorld, int boneMask )
|
||||
|
||||
MDLCACHE_CRITICAL_SECTION();
|
||||
|
||||
AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
|
||||
Assert( GetModelPtr() );
|
||||
|
||||
CStudioHdr *pStudioHdr = GetModelPtr( );
|
||||
|
||||
@@ -2091,7 +2087,7 @@ void CBaseAnimating::GetEyeballs( Vector &origin, QAngle &angles )
|
||||
//=========================================================
|
||||
int CBaseAnimating::FindTransitionSequence( int iCurrentSequence, int iGoalSequence, int *piDir )
|
||||
{
|
||||
AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
|
||||
Assert( GetModelPtr() );
|
||||
|
||||
if (piDir == NULL)
|
||||
{
|
||||
@@ -2140,7 +2136,7 @@ void CBaseAnimating::SetBodygroup( int iGroup, int iValue )
|
||||
{
|
||||
// SetBodygroup is not supported on pending dynamic models. Wait for it to load!
|
||||
// XXX TODO we could buffer up the group and value if we really needed to. -henryg
|
||||
AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
|
||||
Assert( GetModelPtr() );
|
||||
int newBody = m_nBody;
|
||||
::SetBodygroup( GetModelPtr( ), newBody, iGroup, iValue );
|
||||
m_nBody = newBody;
|
||||
@@ -2557,7 +2553,7 @@ void CBaseAnimating::LockStudioHdr()
|
||||
|
||||
if ( pStudioHdrContainer && pStudioHdrContainer->GetVirtualModel() )
|
||||
{
|
||||
MDLHandle_t hVirtualModel = (MDLHandle_t)(int)(pStudioHdrContainer->GetRenderHdr()->virtualModel)&0xffff;
|
||||
MDLHandle_t hVirtualModel = VoidPtrToMDLHandle( pStudioHdrContainer->GetRenderHdr()->VirtualModel() );
|
||||
mdlcache->LockStudioHdr( hVirtualModel );
|
||||
}
|
||||
m_pStudioHdr = pStudioHdrContainer; // must be last to ensure virtual model correctly set up
|
||||
@@ -2575,7 +2571,7 @@ void CBaseAnimating::UnlockStudioHdr()
|
||||
mdlcache->UnlockStudioHdr( modelinfo->GetCacheHandle( mdl ) );
|
||||
if ( m_pStudioHdr->GetVirtualModel() )
|
||||
{
|
||||
MDLHandle_t hVirtualModel = (MDLHandle_t)(int)(m_pStudioHdr->GetRenderHdr()->virtualModel)&0xffff;
|
||||
MDLHandle_t hVirtualModel = VoidPtrToMDLHandle( m_pStudioHdr->GetRenderHdr()->VirtualModel() );
|
||||
mdlcache->UnlockStudioHdr( hVirtualModel );
|
||||
}
|
||||
}
|
||||
@@ -2739,7 +2735,7 @@ void CBaseAnimating::InitBoneControllers ( void ) // FIXME: rename
|
||||
//=========================================================
|
||||
float CBaseAnimating::SetBoneController ( int iController, float flValue )
|
||||
{
|
||||
AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
|
||||
Assert( GetModelPtr() );
|
||||
|
||||
CStudioHdr *pmodel = (CStudioHdr*)GetModelPtr();
|
||||
|
||||
@@ -2756,7 +2752,7 @@ float CBaseAnimating::SetBoneController ( int iController, float flValue )
|
||||
//=========================================================
|
||||
float CBaseAnimating::GetBoneController ( int iController )
|
||||
{
|
||||
AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
|
||||
Assert( GetModelPtr() );
|
||||
|
||||
CStudioHdr *pmodel = (CStudioHdr*)GetModelPtr();
|
||||
|
||||
@@ -2947,7 +2943,7 @@ void CBaseAnimating::SetHitboxSet( int setnum )
|
||||
//-----------------------------------------------------------------------------
|
||||
void CBaseAnimating::SetHitboxSetByName( const char *setname )
|
||||
{
|
||||
AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
|
||||
Assert( GetModelPtr() );
|
||||
m_nHitboxSet = FindHitboxSetByName( GetModelPtr(), setname );
|
||||
}
|
||||
|
||||
@@ -2966,7 +2962,7 @@ int CBaseAnimating::GetHitboxSet( void )
|
||||
//-----------------------------------------------------------------------------
|
||||
const char *CBaseAnimating::GetHitboxSetName( void )
|
||||
{
|
||||
AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
|
||||
Assert( GetModelPtr() );
|
||||
return ::GetHitboxSetName( GetModelPtr(), m_nHitboxSet );
|
||||
}
|
||||
|
||||
@@ -2976,7 +2972,7 @@ const char *CBaseAnimating::GetHitboxSetName( void )
|
||||
//-----------------------------------------------------------------------------
|
||||
int CBaseAnimating::GetHitboxSetCount( void )
|
||||
{
|
||||
AssertMsg( GetModelPtr(), "GetModelPtr NULL. %s", STRING(GetEntityName()) ? STRING(GetEntityName()) : "" );
|
||||
Assert( GetModelPtr() );
|
||||
return ::GetHitboxSetCount( GetModelPtr() );
|
||||
}
|
||||
|
||||
@@ -3307,7 +3303,6 @@ void CBaseAnimating::SetModelScale( float scale, float change_duration /*= 0.0f*
|
||||
mvs->m_flModelScaleGoal = scale;
|
||||
mvs->m_flModelScaleStartTime = gpGlobals->curtime;
|
||||
mvs->m_flModelScaleFinishTime = mvs->m_flModelScaleStartTime + change_duration;
|
||||
SetContextThink( &CBaseAnimating::UpdateModelScale, gpGlobals->curtime, "UpdateModelScaleThink" );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3346,11 +3341,6 @@ void CBaseAnimating::UpdateModelScale()
|
||||
}
|
||||
|
||||
RefreshCollisionBounds();
|
||||
|
||||
if ( frac < 1.f )
|
||||
{
|
||||
SetContextThink( &CBaseAnimating::UpdateModelScale, gpGlobals->curtime, "UpdateModelScaleThink" );
|
||||
}
|
||||
}
|
||||
|
||||
void CBaseAnimating::RefreshCollisionBounds( void )
|
||||
|
||||
@@ -108,7 +108,6 @@ public:
|
||||
void ResetEventIndexes ( void );
|
||||
int SelectWeightedSequence ( Activity activity );
|
||||
int SelectWeightedSequence ( Activity activity, int curSequence );
|
||||
int SelectWeightedSequenceFromModifiers( Activity activity, CUtlSymbol *pActivityModifiers, int iModifierCount );
|
||||
int SelectHeaviestSequence ( Activity activity );
|
||||
int LookupActivity( const char *label );
|
||||
int LookupSequence ( const char *label );
|
||||
@@ -437,14 +436,10 @@ inline CStudioHdr *CBaseAnimating::GetModelPtr( void )
|
||||
return NULL;
|
||||
|
||||
#ifdef _DEBUG
|
||||
if ( !HushAsserts() )
|
||||
{
|
||||
// GetModelPtr() is often called before OnNewModel() so go ahead and set it up first chance.
|
||||
static IDataCacheSection *pModelCache = datacache->FindSection( "ModelData" );
|
||||
AssertOnce( pModelCache->IsFrameLocking() );
|
||||
}
|
||||
// GetModelPtr() is often called before OnNewModel() so go ahead and set it up first chance.
|
||||
static IDataCacheSection *pModelCache = datacache->FindSection( "ModelData" );
|
||||
AssertOnce( pModelCache->IsFrameLocking() );
|
||||
#endif
|
||||
|
||||
if ( !m_pStudioHdr && GetModel() )
|
||||
{
|
||||
LockStudioHdr();
|
||||
|
||||
@@ -731,7 +731,10 @@ CBaseCombatCharacter::CBaseCombatCharacter( void )
|
||||
}
|
||||
|
||||
// not standing on a nav area yet
|
||||
#ifdef MEXT_BOT
|
||||
m_lastNavArea = NULL;
|
||||
#endif
|
||||
|
||||
m_registeredNavTeam = TEAM_INVALID;
|
||||
|
||||
for (int i = 0; i < MAX_WEAPONS; i++)
|
||||
@@ -2280,8 +2283,8 @@ CBaseCombatWeapon *CBaseCombatCharacter::Weapon_GetWpnForAmmo( int iAmmoIndex )
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CBaseCombatCharacter::Weapon_CanUse( CBaseCombatWeapon *pWeapon )
|
||||
{
|
||||
int actCount = 0;
|
||||
acttable_t *pTable = pWeapon->ActivityList( actCount );
|
||||
acttable_t *pTable = pWeapon->ActivityList();
|
||||
int actCount = pWeapon->ActivityListCount();
|
||||
|
||||
if( actCount < 1 )
|
||||
{
|
||||
@@ -3481,17 +3484,20 @@ void CBaseCombatCharacter::UpdateLastKnownArea( void )
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CBaseCombatCharacter::IsAreaTraversable( const CNavArea *area ) const
|
||||
{
|
||||
#ifdef NEXT_BOT
|
||||
return area ? !area->IsBlocked( GetTeamNumber() ) : false;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Leaving the nav mesh
|
||||
//-----------------------------------------------------------------------------
|
||||
void CBaseCombatCharacter::ClearLastKnownArea( void )
|
||||
{
|
||||
#ifdef NEXT_BOT
|
||||
OnNavAreaChanged( NULL, m_lastNavArea );
|
||||
|
||||
|
||||
if ( m_lastNavArea )
|
||||
{
|
||||
m_lastNavArea->DecrementPlayerCount( m_registeredNavTeam, entindex() );
|
||||
@@ -3499,21 +3505,22 @@ void CBaseCombatCharacter::ClearLastKnownArea( void )
|
||||
m_lastNavArea = NULL;
|
||||
m_registeredNavTeam = TEAM_INVALID;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Handling editor removing the area we're standing upon
|
||||
//-----------------------------------------------------------------------------
|
||||
void CBaseCombatCharacter::OnNavAreaRemoved( CNavArea *removedArea )
|
||||
{
|
||||
#ifdef NEXT_BOT
|
||||
if ( m_lastNavArea == removedArea )
|
||||
{
|
||||
ClearLastKnownArea();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Changing team, maintain associated data
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -30,10 +30,6 @@
|
||||
#include "ai_utils.h"
|
||||
#include "physics_impact_damage.h"
|
||||
|
||||
#ifdef TF_DLL
|
||||
#include "tf_shareddefs.h"
|
||||
#endif // TF_DLL
|
||||
|
||||
class CNavArea;
|
||||
class CScriptedTarget;
|
||||
typedef CHandle<CBaseCombatWeapon> CBaseCombatWeaponHandle;
|
||||
@@ -371,7 +367,7 @@ public:
|
||||
virtual bool RemoveEntityRelationship( CBaseEntity *pEntity );
|
||||
virtual void AddClassRelationship( Class_T nClass, Disposition_t nDisposition, int nPriority );
|
||||
|
||||
virtual void ChangeTeam( int iTeamNum ) OVERRIDE;
|
||||
virtual void ChangeTeam( int iTeamNum );
|
||||
|
||||
// Nav hull type
|
||||
Hull_t GetHullType() const { return m_eHull; }
|
||||
@@ -404,11 +400,19 @@ public:
|
||||
void SetPreventWeaponPickup( bool bPrevent ) { m_bPreventWeaponPickup = bPrevent; }
|
||||
bool m_bPreventWeaponPickup;
|
||||
|
||||
virtual CNavArea *GetLastKnownArea( void ) const { return m_lastNavArea; } // return the last nav area the player occupied - NULL if unknown
|
||||
virtual bool IsAreaTraversable( const CNavArea *area ) const; // return true if we can use the given area
|
||||
virtual CNavArea *GetLastKnownArea( void ) const
|
||||
{
|
||||
#ifdef NEXT_BOT
|
||||
return m_lastNavArea;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
} // return the last nav area the player occupied - NULL if unknown
|
||||
|
||||
virtual void ClearLastKnownArea( void );
|
||||
virtual void UpdateLastKnownArea( void ); // invoke this to update our last known nav area (since there is no think method chained to CBaseCombatCharacter)
|
||||
virtual void OnNavAreaChanged( CNavArea *enteredArea, CNavArea *leftArea ) { } // invoked (by UpdateLastKnownArea) when we enter a new nav area (or it is reset to NULL)
|
||||
virtual bool IsAreaTraversable( const CNavArea *area ) const; // return true if we can use the given area
|
||||
virtual void OnNavAreaRemoved( CNavArea *removedArea );
|
||||
|
||||
// -----------------------
|
||||
@@ -416,10 +420,6 @@ public:
|
||||
// -----------------------
|
||||
virtual void OnPursuedBy( INextBot * RESTRICT pPursuer ){} // called every frame while pursued by a bot in DirectChase.
|
||||
|
||||
#ifdef TF_DLL
|
||||
virtual HalloweenBossType GetBossType() const { return HALLOWEEN_BOSS_INVALID; }
|
||||
#endif // TF_DLL
|
||||
|
||||
#ifdef GLOWS_ENABLE
|
||||
// Glows
|
||||
void AddGlowEffect( void );
|
||||
|
||||
+63
-79
@@ -86,7 +86,6 @@ bool CBaseEntity::sm_bDisableTouchFuncs = false; // Disables PhysicsTouch and Ph
|
||||
bool CBaseEntity::sm_bAccurateTriggerBboxChecks = true; // set to false for legacy behavior in ep1
|
||||
|
||||
int CBaseEntity::m_nPredictionRandomSeed = -1;
|
||||
int CBaseEntity::m_nPredictionRandomSeedServer = -1;
|
||||
CBasePlayer *CBaseEntity::m_pPredictionPlayer = NULL;
|
||||
|
||||
// Used to make sure nobody calls UpdateTransmitState directly.
|
||||
@@ -95,6 +94,7 @@ int g_nInsideDispatchUpdateTransmitState = 0;
|
||||
// When this is false, throw an assert in debug when GetAbsAnything is called. Used when hierachy is incomplete/invalid.
|
||||
bool CBaseEntity::s_bAbsQueriesValid = true;
|
||||
|
||||
|
||||
ConVar sv_netvisdist( "sv_netvisdist", "10000", FCVAR_CHEAT | FCVAR_DEVELOPMENTONLY, "Test networking visibility distance" );
|
||||
|
||||
// This table encodes edict data.
|
||||
@@ -344,8 +344,6 @@ void CBaseEntityModelLoadProxy::Handler::OnModelLoadComplete( const model_t *pMo
|
||||
|
||||
CBaseEntity::CBaseEntity( bool bServerOnly )
|
||||
{
|
||||
m_pAttributes = NULL;
|
||||
|
||||
COMPILE_TIME_ASSERT( MOVETYPE_LAST < (1 << MOVETYPE_MAX_BITS) );
|
||||
COMPILE_TIME_ASSERT( MOVECOLLIDE_COUNT < (1 << MOVECOLLIDE_MAX_BITS) );
|
||||
|
||||
@@ -414,8 +412,6 @@ CBaseEntity::CBaseEntity( bool bServerOnly )
|
||||
#ifndef _XBOX
|
||||
AddEFlags( EFL_USE_PARTITION_WHEN_NOT_SOLID );
|
||||
#endif
|
||||
|
||||
m_bTruceValidForEnt = false;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -1263,7 +1259,7 @@ void CBaseEntity::ValidateEntityConnections()
|
||||
typedescription_t *dataDesc = &dmap->dataDesc[i];
|
||||
if ( ( dataDesc->fieldType == FIELD_CUSTOM ) && ( dataDesc->flags & FTYPEDESC_OUTPUT ) )
|
||||
{
|
||||
CBaseEntityOutput *pOutput = (CBaseEntityOutput *)((int)this + (int)dataDesc->fieldOffset[0]);
|
||||
CBaseEntityOutput *pOutput = (CBaseEntityOutput *)((intp)this + (intp)dataDesc->fieldOffset[0]);
|
||||
if ( pOutput->NumberOfElements() )
|
||||
return;
|
||||
}
|
||||
@@ -1296,7 +1292,7 @@ void CBaseEntity::FireNamedOutput( const char *pszOutput, variant_t variant, CBa
|
||||
typedescription_t *dataDesc = &dmap->dataDesc[i];
|
||||
if ( ( dataDesc->fieldType == FIELD_CUSTOM ) && ( dataDesc->flags & FTYPEDESC_OUTPUT ) )
|
||||
{
|
||||
CBaseEntityOutput *pOutput = ( CBaseEntityOutput * )( ( int )this + ( int )dataDesc->fieldOffset[0] );
|
||||
CBaseEntityOutput *pOutput = ( CBaseEntityOutput * )( ( intp )this + ( intp )dataDesc->fieldOffset[0] );
|
||||
if ( !Q_stricmp( dataDesc->externalName, pszOutput ) )
|
||||
{
|
||||
pOutput->FireOutput( variant, pActivator, pCaller, flDelay );
|
||||
@@ -1442,10 +1438,10 @@ int CBaseEntity::OnTakeDamage( const CTakeDamageInfo &info )
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Scale damage done and call OnTakeDamage
|
||||
//-----------------------------------------------------------------------------
|
||||
int CBaseEntity::TakeDamage( const CTakeDamageInfo &inputInfo )
|
||||
void CBaseEntity::TakeDamage( const CTakeDamageInfo &inputInfo )
|
||||
{
|
||||
if ( !g_pGameRules )
|
||||
return 0;
|
||||
return;
|
||||
|
||||
bool bHasPhysicsForceDamage = !g_pGameRules->Damage_NoPhysicsForce( inputInfo.GetDamageType() );
|
||||
if ( bHasPhysicsForceDamage && inputInfo.GetDamageType() != DMG_GENERIC )
|
||||
@@ -1477,12 +1473,12 @@ int CBaseEntity::TakeDamage( const CTakeDamageInfo &inputInfo )
|
||||
// Make sure our damage filter allows the damage.
|
||||
if ( !PassesDamageFilter( inputInfo ))
|
||||
{
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if( !g_pGameRules->AllowDamage(this, inputInfo) )
|
||||
{
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( PhysIsInCallback() )
|
||||
@@ -1504,9 +1500,8 @@ int CBaseEntity::TakeDamage( const CTakeDamageInfo &inputInfo )
|
||||
|
||||
//Msg("%s took %.2f Damage, at %.2f\n", GetClassname(), info.GetDamage(), gpGlobals->curtime );
|
||||
|
||||
return OnTakeDamage( info );
|
||||
OnTakeDamage( info );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -3804,7 +3799,7 @@ void CBaseEntity::OnEntityEvent( EntityEvent_t event, void *pEventData )
|
||||
{
|
||||
case ENTITY_EVENT_WATER_TOUCH:
|
||||
{
|
||||
int nContents = (int)pEventData;
|
||||
intp nContents = (intp)pEventData;
|
||||
if ( !nContents || (nContents & CONTENTS_WATER) )
|
||||
{
|
||||
++m_nWaterTouch;
|
||||
@@ -3818,7 +3813,7 @@ void CBaseEntity::OnEntityEvent( EntityEvent_t event, void *pEventData )
|
||||
|
||||
case ENTITY_EVENT_WATER_UNTOUCH:
|
||||
{
|
||||
int nContents = (int)pEventData;
|
||||
intp nContents = (intp)pEventData;
|
||||
if ( !nContents || (nContents & CONTENTS_WATER) )
|
||||
{
|
||||
--m_nWaterTouch;
|
||||
@@ -4339,7 +4334,7 @@ CTeam *CBaseEntity::GetTeam( void ) const
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Returns true if these players are both in at least one team together
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CBaseEntity::InSameTeam( const CBaseEntity *pEntity ) const
|
||||
bool CBaseEntity::InSameTeam( CBaseEntity *pEntity ) const
|
||||
{
|
||||
if ( !pEntity )
|
||||
return false;
|
||||
@@ -4827,7 +4822,7 @@ void CBaseEntity::PrecacheModelComponents( int nModelIndex )
|
||||
char token[256];
|
||||
const char *pOptions = pEvent->pszOptions();
|
||||
nexttoken( token, pOptions, ' ' );
|
||||
if ( token[0] )
|
||||
if ( token )
|
||||
{
|
||||
PrecacheParticleSystem( token );
|
||||
}
|
||||
@@ -4913,9 +4908,7 @@ int CBaseEntity::PrecacheModel( const char *name, bool bPreload )
|
||||
{
|
||||
if ( !name || !*name )
|
||||
{
|
||||
#ifdef STAGING_ONLY
|
||||
Msg( "Attempting to precache model, but model name is NULL\n");
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -4924,7 +4917,8 @@ int CBaseEntity::PrecacheModel( const char *name, bool bPreload )
|
||||
{
|
||||
if ( !engine->IsModelPrecached( name ) )
|
||||
{
|
||||
DevMsg( "Late precache of %s -- not necessarily a bug now that we allow ~everything to be dynamically loaded.\n", name );
|
||||
Assert( !"CBaseEntity::PrecacheModel: too late" );
|
||||
Warning( "Late precache of %s\n", name );
|
||||
}
|
||||
}
|
||||
#if defined( WATCHACCESS )
|
||||
@@ -5734,53 +5728,42 @@ void CBaseEntity::CalcAbsolutePosition( void )
|
||||
if (!IsEFlagSet( EFL_DIRTY_ABSTRANSFORM ))
|
||||
return;
|
||||
|
||||
RemoveEFlags( EFL_DIRTY_ABSTRANSFORM );
|
||||
|
||||
// Plop the entity->parent matrix into m_rgflCoordinateFrame
|
||||
AngleMatrix( m_angRotation, m_vecOrigin, m_rgflCoordinateFrame );
|
||||
|
||||
CBaseEntity *pMoveParent = GetMoveParent();
|
||||
if ( !pMoveParent )
|
||||
{
|
||||
AUTO_LOCK( m_CalcAbsolutePositionMutex );
|
||||
|
||||
// Test again under the lock, in case another thread did the work in the interim
|
||||
if ( !IsEFlagSet( EFL_DIRTY_ABSTRANSFORM ) )
|
||||
// no move parent, so just copy existing values
|
||||
m_vecAbsOrigin = m_vecOrigin;
|
||||
m_angAbsRotation = m_angRotation;
|
||||
if ( HasDataObjectType( POSITIONWATCHER ) )
|
||||
{
|
||||
return;
|
||||
ReportPositionChanged( this );
|
||||
}
|
||||
|
||||
// Plop the entity->parent matrix into m_rgflCoordinateFrame
|
||||
AngleMatrix( m_angRotation, m_vecOrigin, m_rgflCoordinateFrame );
|
||||
|
||||
CBaseEntity *pMoveParent = GetMoveParent();
|
||||
if ( !pMoveParent )
|
||||
{
|
||||
// no move parent, so just copy existing values
|
||||
m_vecAbsOrigin = m_vecOrigin;
|
||||
m_angAbsRotation = m_angRotation;
|
||||
}
|
||||
else
|
||||
{
|
||||
// concatenate with our parent's transform
|
||||
matrix3x4_t tmpMatrix, scratchSpace;
|
||||
ConcatTransforms( GetParentToWorldTransform( scratchSpace ), m_rgflCoordinateFrame, tmpMatrix );
|
||||
MatrixCopy( tmpMatrix, m_rgflCoordinateFrame );
|
||||
|
||||
// pull our absolute position out of the matrix
|
||||
MatrixGetColumn( m_rgflCoordinateFrame, 3, m_vecAbsOrigin );
|
||||
|
||||
// if we have any angles, we have to extract our absolute angles from our matrix
|
||||
if ( ( m_angRotation == vec3_angle ) && ( m_iParentAttachment == 0 ) )
|
||||
{
|
||||
// just copy our parent's absolute angles
|
||||
VectorCopy( pMoveParent->GetAbsAngles(), m_angAbsRotation );
|
||||
}
|
||||
else
|
||||
{
|
||||
MatrixAngles( m_rgflCoordinateFrame, m_angAbsRotation );
|
||||
}
|
||||
}
|
||||
|
||||
ThreadMemoryBarrier();
|
||||
RemoveEFlags( EFL_DIRTY_ABSTRANSFORM );
|
||||
return;
|
||||
}
|
||||
|
||||
// Do this callback *after* we have updated the position, and (importantly) after we clear the dirty flag, because this callback can potentially
|
||||
// end up recursively calling back in here, so the dirty flag must be cleared to break the recursion in that case.
|
||||
// concatenate with our parent's transform
|
||||
matrix3x4_t tmpMatrix, scratchSpace;
|
||||
ConcatTransforms( GetParentToWorldTransform( scratchSpace ), m_rgflCoordinateFrame, tmpMatrix );
|
||||
MatrixCopy( tmpMatrix, m_rgflCoordinateFrame );
|
||||
|
||||
// pull our absolute position out of the matrix
|
||||
MatrixGetColumn( m_rgflCoordinateFrame, 3, m_vecAbsOrigin );
|
||||
|
||||
// if we have any angles, we have to extract our absolute angles from our matrix
|
||||
if (( m_angRotation == vec3_angle ) && ( m_iParentAttachment == 0 ))
|
||||
{
|
||||
// just copy our parent's absolute angles
|
||||
VectorCopy( pMoveParent->GetAbsAngles(), m_angAbsRotation );
|
||||
}
|
||||
else
|
||||
{
|
||||
MatrixAngles( m_rgflCoordinateFrame, m_angAbsRotation );
|
||||
}
|
||||
if ( HasDataObjectType( POSITIONWATCHER ) )
|
||||
{
|
||||
ReportPositionChanged( this );
|
||||
@@ -6103,7 +6086,7 @@ void CBaseEntity::SetLocalAngles( const QAngle& angles )
|
||||
{
|
||||
Warning( "Bad SetLocalAngles(%f,%f,%f) on %s\n", angles.x, angles.y, angles.z, GetDebugName() );
|
||||
}
|
||||
AssertMsg( false, "Bad SetLocalAngles(%f,%f,%f) on %s\n", angles.x, angles.y, angles.z, GetDebugName() );
|
||||
Assert( false );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -6668,19 +6651,23 @@ void CBaseEntity::DispatchResponse( const char *conceptName )
|
||||
AI_Response result;
|
||||
bool found = rs->FindBestResponse( set, result );
|
||||
if ( !found )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle the response here...
|
||||
const char *szResponse = result.GetResponsePtr();
|
||||
char response[ 256 ];
|
||||
result.GetResponse( response, sizeof( response ) );
|
||||
switch ( result.GetType() )
|
||||
{
|
||||
case RESPONSE_SPEAK:
|
||||
EmitSound( szResponse );
|
||||
{
|
||||
EmitSound( response );
|
||||
}
|
||||
break;
|
||||
|
||||
case RESPONSE_SENTENCE:
|
||||
{
|
||||
int sentenceIndex = SENTENCEG_Lookup( szResponse );
|
||||
int sentenceIndex = SENTENCEG_Lookup( response );
|
||||
if( sentenceIndex == -1 )
|
||||
{
|
||||
// sentence not found
|
||||
@@ -6692,13 +6679,16 @@ void CBaseEntity::DispatchResponse( const char *conceptName )
|
||||
CBaseEntity::EmitSentenceByIndex( filter, entindex(), CHAN_VOICE, sentenceIndex, 1, result.GetSoundLevel(), 0, PITCH_NORM );
|
||||
}
|
||||
break;
|
||||
|
||||
case RESPONSE_SCENE:
|
||||
// Try to fire scene w/o an actor
|
||||
InstancedScriptedScene( NULL, szResponse );
|
||||
{
|
||||
// Try to fire scene w/o an actor
|
||||
InstancedScriptedScene( NULL, response );
|
||||
}
|
||||
break;
|
||||
|
||||
case RESPONSE_PRINT:
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// Don't know how to handle .vcds!!!
|
||||
@@ -7056,7 +7046,7 @@ void CBaseEntity::SetRefEHandle( const CBaseHandle &handle )
|
||||
if ( edict() )
|
||||
{
|
||||
COMPILE_TIME_ASSERT( NUM_NETWORKED_EHANDLE_SERIAL_NUMBER_BITS <= 8*sizeof( edict()->m_NetworkSerialNumber ) );
|
||||
edict()->m_NetworkSerialNumber = m_RefEHandle.GetSerialNumber() & ( (1 << NUM_NETWORKED_EHANDLE_SERIAL_NUMBER_BITS) - 1 );
|
||||
edict()->m_NetworkSerialNumber = (m_RefEHandle.GetSerialNumber() & (1 << NUM_NETWORKED_EHANDLE_SERIAL_NUMBER_BITS) - 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7414,19 +7404,13 @@ bool CC_GetCommandEnt( const CCommand& args, CBaseEntity **ent, Vector *vecTarge
|
||||
}
|
||||
|
||||
CBasePlayer *pPlayer = UTIL_GetCommandClient();
|
||||
if ( !pPlayer )
|
||||
{
|
||||
Msg( "Command must originate from a player\n" );
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( vecTargetPoint )
|
||||
{
|
||||
trace_t tr;
|
||||
Vector forward;
|
||||
pPlayer->EyeVectors( &forward );
|
||||
UTIL_TraceLine(pPlayer->EyePosition(),
|
||||
pPlayer->EyePosition() + forward * MAX_TRACE_LENGTH,MASK_NPCSOLID,
|
||||
pPlayer->EyePosition() + forward * MAX_TRACE_LENGTH,MASK_NPCSOLID,
|
||||
pPlayer, COLLISION_GROUP_NONE, &tr );
|
||||
|
||||
if ( tr.fraction != 1.0 )
|
||||
|
||||
+30
-36
@@ -83,7 +83,7 @@ class CUserCmd;
|
||||
class CSkyCamera;
|
||||
class CEntityMapData;
|
||||
class INextBot;
|
||||
class IHasAttributes;
|
||||
|
||||
|
||||
typedef CUtlVector< CBaseEntity* > EntityList_t;
|
||||
|
||||
@@ -904,7 +904,7 @@ public:
|
||||
virtual int OnTakeDamage( const CTakeDamageInfo &info );
|
||||
|
||||
// This is what you should call to apply damage to an entity.
|
||||
int TakeDamage( const CTakeDamageInfo &info );
|
||||
void TakeDamage( const CTakeDamageInfo &info );
|
||||
virtual void AdjustDamageDirection( const CTakeDamageInfo &info, Vector &dir, CBaseEntity *pEnt ) {}
|
||||
|
||||
virtual int TakeHealth( float flHealth, int bitsDamageType );
|
||||
@@ -965,7 +965,7 @@ public:
|
||||
int GetTeamNumber( void ) const; // Get the Team number of the team this entity is on
|
||||
virtual void ChangeTeam( int iTeamNum ); // Assign this entity to a team.
|
||||
bool IsInTeam( CTeam *pTeam ) const; // Returns true if this entity's in the specified team
|
||||
bool InSameTeam( const CBaseEntity *pEntity ) const; // Returns true if the specified entity is on the same team as this one
|
||||
bool InSameTeam( CBaseEntity *pEntity ) const; // Returns true if the specified entity is on the same team as this one
|
||||
bool IsInAnyTeam( void ) const; // Returns true if this entity is in any team
|
||||
const char *TeamID( void ) const; // Returns the name of the team this entity is on.
|
||||
|
||||
@@ -1087,57 +1087,64 @@ public:
|
||||
int GetHealth() const { return m_iHealth; }
|
||||
void SetHealth( int amt ) { m_iHealth = amt; }
|
||||
|
||||
float HealthFraction() const;
|
||||
|
||||
// Ugly code to lookup all functions to make sure they are in the table when set.
|
||||
#ifdef _DEBUG
|
||||
|
||||
#ifdef PLATFORM_64BITS
|
||||
#ifdef GNUC
|
||||
#define ENTITYFUNCPTR_SIZE 16
|
||||
#else
|
||||
#define ENTITYFUNCPTR_SIZE 8
|
||||
#endif
|
||||
#else
|
||||
#ifdef GNUC
|
||||
#define ENTITYFUNCPTR_SIZE 8
|
||||
#else
|
||||
#define ENTITYFUNCPTR_SIZE 4
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void FunctionCheck( void *pFunction, const char *name );
|
||||
|
||||
ENTITYFUNCPTR TouchSet( ENTITYFUNCPTR func, char *name )
|
||||
{
|
||||
COMPILE_TIME_ASSERT( sizeof(func) == ENTITYFUNCPTR_SIZE );
|
||||
#ifdef GNUC
|
||||
COMPILE_TIME_ASSERT( sizeof(func) == 8 );
|
||||
#else
|
||||
COMPILE_TIME_ASSERT( sizeof(func) == 4 );
|
||||
#endif
|
||||
m_pfnTouch = func;
|
||||
FunctionCheck( *(reinterpret_cast<void **>(&m_pfnTouch)), name );
|
||||
return func;
|
||||
}
|
||||
USEPTR UseSet( USEPTR func, char *name )
|
||||
{
|
||||
COMPILE_TIME_ASSERT( sizeof(func) == ENTITYFUNCPTR_SIZE );
|
||||
#ifdef GNUC
|
||||
COMPILE_TIME_ASSERT( sizeof(func) == 8 );
|
||||
#else
|
||||
COMPILE_TIME_ASSERT( sizeof(func) == 4 );
|
||||
#endif
|
||||
m_pfnUse = func;
|
||||
FunctionCheck( *(reinterpret_cast<void **>(&m_pfnUse)), name );
|
||||
return func;
|
||||
}
|
||||
ENTITYFUNCPTR BlockedSet( ENTITYFUNCPTR func, char *name )
|
||||
{
|
||||
COMPILE_TIME_ASSERT( sizeof(func) == ENTITYFUNCPTR_SIZE );
|
||||
#ifdef GNUC
|
||||
COMPILE_TIME_ASSERT( sizeof(func) == 8 );
|
||||
#else
|
||||
COMPILE_TIME_ASSERT( sizeof(func) == 4 );
|
||||
#endif
|
||||
m_pfnBlocked = func;
|
||||
FunctionCheck( *(reinterpret_cast<void **>(&m_pfnBlocked)), name );
|
||||
return func;
|
||||
}
|
||||
|
||||
#endif // _DEBUG
|
||||
|
||||
#endif
|
||||
virtual void ModifyOrAppendCriteria( AI_CriteriaSet& set );
|
||||
void AppendContextToCriteria( AI_CriteriaSet& set, const char *prefix = "" );
|
||||
void DumpResponseCriteria( void );
|
||||
|
||||
// Return the IHasAttributes interface for this base entity. Removes the need for:
|
||||
// dynamic_cast< IHasAttributes * >( pEntity );
|
||||
// Which is remarkably slow.
|
||||
// GetAttribInterface( CBaseEntity *pEntity ) in attribute_manager.h uses
|
||||
// this function, tests for NULL, and Asserts m_pAttributes == dynamic_cast.
|
||||
inline IHasAttributes *GetHasAttributesInterfacePtr() const { return m_pAttributes; }
|
||||
|
||||
protected:
|
||||
// NOTE: m_pAttributes needs to be set in the leaf class constructor.
|
||||
IHasAttributes *m_pAttributes;
|
||||
|
||||
|
||||
private:
|
||||
friend class CAI_Senses;
|
||||
CBaseEntity *m_pLink;// used for temporary link-list operations.
|
||||
@@ -1748,7 +1755,6 @@ private:
|
||||
// randon number generators to spit out the same random numbers on both sides for a particular
|
||||
// usercmd input.
|
||||
static int m_nPredictionRandomSeed;
|
||||
static int m_nPredictionRandomSeedServer;
|
||||
static CBasePlayer *m_pPredictionPlayer;
|
||||
|
||||
// FIXME: Make hierarchy a member of CBaseEntity
|
||||
@@ -1762,7 +1768,7 @@ private:
|
||||
|
||||
public:
|
||||
// Accessors for above
|
||||
static int GetPredictionRandomSeed( bool bUseUnSyncedServerPlatTime = false );
|
||||
static int GetPredictionRandomSeed( void );
|
||||
static void SetPredictionRandomSeed( const CUserCmd *cmd );
|
||||
static CBasePlayer *GetPredictionPlayer( void );
|
||||
static void SetPredictionPlayer( CBasePlayer *player );
|
||||
@@ -1800,18 +1806,6 @@ public:
|
||||
{
|
||||
return s_bAbsQueriesValid;
|
||||
}
|
||||
|
||||
virtual bool ShouldBlockNav() const { return true; }
|
||||
|
||||
virtual bool ShouldForceTransmitsForTeam( int iTeam ) { return false; }
|
||||
|
||||
void SetTruceValidForEnt( bool bTruceValidForEnt ) { m_bTruceValidForEnt = bTruceValidForEnt; }
|
||||
virtual bool IsTruceValidForEnt( void ) const { return m_bTruceValidForEnt; }
|
||||
|
||||
private:
|
||||
CThreadFastMutex m_CalcAbsolutePositionMutex;
|
||||
|
||||
bool m_bTruceValidForEnt;
|
||||
};
|
||||
|
||||
// Send tables exposed in this module.
|
||||
|
||||
@@ -113,7 +113,7 @@ CBaseFlex::CBaseFlex( void ) :
|
||||
CBaseFlex::~CBaseFlex( void )
|
||||
{
|
||||
m_LocalToGlobal.RemoveAll();
|
||||
AssertMsg( m_SceneEvents.Count() == 0, "m_ScenesEvent.Count != 0: %d", m_SceneEvents.Count() );
|
||||
Assert( m_SceneEvents.Count() == 0 );
|
||||
}
|
||||
|
||||
void CBaseFlex::SetModel( const char *szModelName )
|
||||
@@ -508,7 +508,7 @@ bool CBaseFlex::HandleStartSequenceSceneEvent( CSceneEventInfo *info, CChoreoSce
|
||||
float seq_duration = SequenceDuration( info->m_nSequence );
|
||||
float flCycle = dt / seq_duration;
|
||||
flCycle = flCycle - (int)flCycle; // loop
|
||||
SetLayerCycle( info->m_iLayer, flCycle, flCycle, 0.f );
|
||||
SetLayerCycle( info->m_iLayer, flCycle, flCycle );
|
||||
|
||||
SetLayerPlaybackRate( info->m_iLayer, 0.0 );
|
||||
}
|
||||
@@ -801,6 +801,7 @@ void CBaseFlex::RemoveSceneEvent( CChoreoScene *scene, CChoreoEvent *event, bool
|
||||
info->m_bStarted = false;
|
||||
|
||||
m_SceneEvents.Remove( i );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2554,7 +2555,7 @@ void CFlexCycler::Think( void )
|
||||
{
|
||||
m_flexnum = LookupFlex( szTemp );
|
||||
|
||||
if (m_flexnum != LocalFlexController_t(-1) && m_flextarget[m_flexnum] != 1)
|
||||
if (m_flexnum != -1 && m_flextarget[m_flexnum] != 1)
|
||||
{
|
||||
m_flextarget[m_flexnum] = 1.0;
|
||||
// SetFlexTarget( m_flexnum );
|
||||
|
||||
@@ -87,11 +87,10 @@ IResponseSystem *CBaseMultiplayerPlayer::GetResponseSystem()
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Doesn't actually speak the concept. Just finds a response in the system. You then have to play it yourself.
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CBaseMultiplayerPlayer::SpeakConcept( AI_Response &response, int iConcept )
|
||||
AI_Response *CBaseMultiplayerPlayer::SpeakConcept( int iConcept )
|
||||
{
|
||||
// Save the current concept.
|
||||
m_iCurrentConcept = iConcept;
|
||||
return SpeakFindResponse( response, g_pszMPConcepts[iConcept] );
|
||||
return SpeakFindResponse( g_pszMPConcepts[iConcept] );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
|
||||
virtual bool SpeakIfAllowed( AIConcept_t concept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL );
|
||||
virtual IResponseSystem *GetResponseSystem();
|
||||
bool SpeakConcept( AI_Response& response, int iConcept );
|
||||
AI_Response *SpeakConcept( int iConcept );
|
||||
virtual bool SpeakConceptIfAllowed( int iConcept, const char *modifiers = NULL, char *pszOutResponseChosen = NULL, size_t bufsize = 0, IRecipientFilter *filter = NULL );
|
||||
|
||||
virtual bool CanHearAndReadChatFrom( CBasePlayer *pPlayer );
|
||||
|
||||
@@ -467,7 +467,7 @@ void CBaseEntityOutput::DeleteAllElements( void )
|
||||
m_ActionList = NULL;
|
||||
while (pNext)
|
||||
{
|
||||
CEventAction *strikeThis = pNext;
|
||||
register CEventAction *strikeThis = pNext;
|
||||
pNext = pNext->m_pNext;
|
||||
delete strikeThis;
|
||||
}
|
||||
@@ -1486,7 +1486,7 @@ bool variant_t::Convert( fieldtype_t newType )
|
||||
//-----------------------------------------------------------------------------
|
||||
const char *variant_t::ToString( void ) const
|
||||
{
|
||||
COMPILE_TIME_ASSERT( sizeof(string_t) == sizeof(int) );
|
||||
COMPILE_TIME_ASSERT( sizeof(string_t) == sizeof(intp) );
|
||||
|
||||
static char szBuf[512];
|
||||
|
||||
|
||||
+15
-85
@@ -57,60 +57,6 @@ extern bool IsInCommentaryMode( void );
|
||||
|
||||
ConVar *sv_cheats = NULL;
|
||||
|
||||
enum eAllowPointServerCommand {
|
||||
eAllowNever,
|
||||
eAllowOfficial,
|
||||
eAllowAlways
|
||||
};
|
||||
|
||||
#ifdef TF_DLL
|
||||
// The default value here should match the default of the convar
|
||||
eAllowPointServerCommand sAllowPointServerCommand = eAllowOfficial;
|
||||
#else
|
||||
eAllowPointServerCommand sAllowPointServerCommand = eAllowAlways;
|
||||
#endif // TF_DLL
|
||||
|
||||
void sv_allow_point_servercommand_changed( IConVar *pConVar, const char *pOldString, float flOldValue )
|
||||
{
|
||||
ConVarRef var( pConVar );
|
||||
if ( !var.IsValid() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const char *pNewValue = var.GetString();
|
||||
if ( V_strcasecmp ( pNewValue, "always" ) == 0 )
|
||||
{
|
||||
sAllowPointServerCommand = eAllowAlways;
|
||||
}
|
||||
#ifdef TF_DLL
|
||||
else if ( V_strcasecmp ( pNewValue, "official" ) == 0 )
|
||||
{
|
||||
sAllowPointServerCommand = eAllowOfficial;
|
||||
}
|
||||
#endif // TF_DLL
|
||||
else
|
||||
{
|
||||
sAllowPointServerCommand = eAllowNever;
|
||||
}
|
||||
}
|
||||
|
||||
ConVar sv_allow_point_servercommand ( "sv_allow_point_servercommand",
|
||||
#ifdef TF_DLL
|
||||
// The default value here should match the default of the convar
|
||||
"official",
|
||||
#else
|
||||
// Other games may use this in their official maps, and only TF exposes IsValveMap() currently
|
||||
"always",
|
||||
#endif // TF_DLL
|
||||
FCVAR_NONE,
|
||||
"Allow use of point_servercommand entities in map. Potentially dangerous for untrusted maps.\n"
|
||||
" disallow : Always disallow\n"
|
||||
#ifdef TF_DLL
|
||||
" official : Allowed for valve maps only\n"
|
||||
#endif // TF_DLL
|
||||
" always : Allow for all maps", sv_allow_point_servercommand_changed );
|
||||
|
||||
void ClientKill( edict_t *pEdict, const Vector &vecForce, bool bExplode = false )
|
||||
{
|
||||
CBasePlayer *pPlayer = static_cast<CBasePlayer*>( GetContainingEntity( pEdict ) );
|
||||
@@ -623,22 +569,7 @@ void CPointServerCommand::InputCommand( inputdata_t& inputdata )
|
||||
if ( !inputdata.value.String()[0] )
|
||||
return;
|
||||
|
||||
bool bAllowed = ( sAllowPointServerCommand == eAllowAlways );
|
||||
#ifdef TF_DLL
|
||||
if ( sAllowPointServerCommand == eAllowOfficial )
|
||||
{
|
||||
bAllowed = TFGameRules() && TFGameRules()->IsValveMap();
|
||||
}
|
||||
#endif // TF_DLL
|
||||
|
||||
if ( bAllowed )
|
||||
{
|
||||
engine->ServerCommand( UTIL_VarArgs( "%s\n", inputdata.value.String() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
Warning( "point_servercommand usage blocked by sv_allow_point_servercommand setting\n" );
|
||||
}
|
||||
engine->ServerCommand( UTIL_VarArgs( "%s\n", inputdata.value.String() ) );
|
||||
}
|
||||
|
||||
BEGIN_DATADESC( CPointServerCommand )
|
||||
@@ -657,19 +588,19 @@ void CC_DrawLine( const CCommand &args )
|
||||
Vector startPos;
|
||||
Vector endPos;
|
||||
|
||||
startPos.x = clamp( atof(args[1]), MIN_COORD_FLOAT, MAX_COORD_FLOAT );
|
||||
startPos.y = clamp( atof(args[2]), MIN_COORD_FLOAT, MAX_COORD_FLOAT );
|
||||
startPos.z = clamp( atof(args[3]), MIN_COORD_FLOAT, MAX_COORD_FLOAT );
|
||||
endPos.x = clamp( atof(args[4]), MIN_COORD_FLOAT, MAX_COORD_FLOAT );
|
||||
endPos.y = clamp( atof(args[5]), MIN_COORD_FLOAT, MAX_COORD_FLOAT );
|
||||
endPos.z = clamp( atof(args[6]), MIN_COORD_FLOAT, MAX_COORD_FLOAT );
|
||||
startPos.x = atof(args[1]);
|
||||
startPos.y = atof(args[2]);
|
||||
startPos.z = atof(args[3]);
|
||||
endPos.x = atof(args[4]);
|
||||
endPos.y = atof(args[5]);
|
||||
endPos.z = atof(args[6]);
|
||||
|
||||
UTIL_AddDebugLine(startPos,endPos,true,true);
|
||||
}
|
||||
static ConCommand drawline("drawline", CC_DrawLine, "Draws line between two 3D Points.\n\tGreen if no collision\n\tRed is collides with something\n\tArguments: x1 y1 z1 x2 y2 z2", FCVAR_CHEAT);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Purpose : Draw a cross at a points.
|
||||
// Purpose : Draw a cross at a points.
|
||||
// Input :
|
||||
// Output :
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -677,9 +608,9 @@ void CC_DrawCross( const CCommand &args )
|
||||
{
|
||||
Vector vPosition;
|
||||
|
||||
vPosition.x = clamp( atof(args[1]), MIN_COORD_FLOAT, MAX_COORD_FLOAT );
|
||||
vPosition.y = clamp( atof(args[2]), MIN_COORD_FLOAT, MAX_COORD_FLOAT );
|
||||
vPosition.z = clamp( atof(args[3]), MIN_COORD_FLOAT, MAX_COORD_FLOAT );
|
||||
vPosition.x = atof(args[1]);
|
||||
vPosition.y = atof(args[2]);
|
||||
vPosition.z = atof(args[3]);
|
||||
|
||||
// Offset since min and max z in not about center
|
||||
Vector mins = Vector(-5,-5,-5);
|
||||
@@ -1249,9 +1180,9 @@ CON_COMMAND_F( setpos, "Move player to specified origin (must have sv_cheats).",
|
||||
Vector oldorigin = pPlayer->GetAbsOrigin();
|
||||
|
||||
Vector newpos;
|
||||
newpos.x = clamp( atof( args[1] ), MIN_COORD_FLOAT, MAX_COORD_FLOAT );
|
||||
newpos.y = clamp( atof( args[2] ), MIN_COORD_FLOAT, MAX_COORD_FLOAT );
|
||||
newpos.z = args.ArgC() == 4 ? clamp( atof( args[3] ), MIN_COORD_FLOAT, MAX_COORD_FLOAT ) : oldorigin.z;
|
||||
newpos.x = atof( args[1] );
|
||||
newpos.y = atof( args[2] );
|
||||
newpos.z = args.ArgC() == 4 ? atof( args[3] ) : oldorigin.z;
|
||||
|
||||
pPlayer->SetAbsOrigin( newpos );
|
||||
|
||||
@@ -1418,7 +1349,6 @@ void CC_HurtMe_f(const CCommand &args)
|
||||
|
||||
static ConCommand hurtme("hurtme", CC_HurtMe_f, "Hurts the player.\n\tArguments: <health to lose>", FCVAR_CHEAT);
|
||||
|
||||
#ifdef DBGFLAG_ASSERT
|
||||
static bool IsInGroundList( CBaseEntity *ent, CBaseEntity *ground )
|
||||
{
|
||||
if ( !ground || !ent )
|
||||
@@ -1438,8 +1368,8 @@ static bool IsInGroundList( CBaseEntity *ent, CBaseEntity *ground )
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
static int DescribeGroundList( CBaseEntity *ent )
|
||||
{
|
||||
|
||||
@@ -150,8 +150,6 @@ public:
|
||||
bool ShouldLoopMoveSound( void ) { return m_bLoopMoveSound; }
|
||||
bool m_bLoopMoveSound; // Move sound loops until stopped
|
||||
|
||||
virtual bool ShouldBlockNav() const OVERRIDE { return false; }
|
||||
|
||||
private:
|
||||
void ChainUse( void ); ///< Chains +use on through to m_ChainTarget
|
||||
void ChainTouch( CBaseEntity *pOther ); ///< Chains touch on through to m_ChainTarget
|
||||
|
||||
@@ -1539,11 +1539,11 @@ public:
|
||||
DECLARE_SERVERCLASS();
|
||||
|
||||
private:
|
||||
#ifdef POSIX
|
||||
//#ifdef POSIX
|
||||
CEnvWindShared m_EnvWindShared; // FIXME - fails to compile as networked var due to operator= problem
|
||||
#else
|
||||
CNetworkVarEmbedded( CEnvWindShared, m_EnvWindShared );
|
||||
#endif
|
||||
//#else
|
||||
// CNetworkVarEmbedded( CEnvWindShared, m_EnvWindShared );
|
||||
//#endif
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS( env_wind, CEnvWind );
|
||||
|
||||
@@ -1105,7 +1105,7 @@ void CGlobalEntityList::OnAddEntity( IHandleEntity *pEnt, CBaseHandle handle )
|
||||
|
||||
void CGlobalEntityList::OnRemoveEntity( IHandleEntity *pEnt, CBaseHandle handle )
|
||||
{
|
||||
#ifdef DBGFLAG_ASSERT
|
||||
#ifdef DEBUG
|
||||
if ( !g_fInCleanupDelete )
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -155,6 +155,7 @@ public:
|
||||
|
||||
CBaseEntity *FindEntityNearestFacing( const Vector &origin, const Vector &facing, float threshold);
|
||||
CBaseEntity *FindEntityClassNearestFacing( const Vector &origin, const Vector &facing, float threshold, char *classname);
|
||||
CBaseEntity *FindEntityByNetname( CBaseEntity *pStartEntity, const char *szModelName );
|
||||
|
||||
CBaseEntity *FindEntityProcedural( const char *szName, CBaseEntity *pSearchingEntity = NULL, CBaseEntity *pActivator = NULL, CBaseEntity *pCaller = NULL );
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@ public:
|
||||
{
|
||||
Ep2LevelStats_t::EntityDeathsLump_t data;
|
||||
char npcName[ 512 ];
|
||||
LoadBuffer.GetString( npcName );
|
||||
LoadBuffer.GetString( npcName, sizeof( npcName ) );
|
||||
LoadBuffer.Get( &data, sizeof( data ) );
|
||||
pItem->m_dictEntityDeaths.Insert( npcName, data );
|
||||
}
|
||||
@@ -229,7 +229,7 @@ public:
|
||||
{
|
||||
Ep2LevelStats_t::WeaponLump_t data;
|
||||
char weaponName[ 512 ];
|
||||
LoadBuffer.GetString( weaponName );
|
||||
LoadBuffer.GetString( weaponName, sizeof( weaponName ) );
|
||||
LoadBuffer.Get( &data, sizeof( data ) );
|
||||
pItem->m_dictWeapons.Insert( weaponName, data );
|
||||
}
|
||||
@@ -240,7 +240,7 @@ public:
|
||||
Assert( pItem );
|
||||
Ep2LevelStats_t::SaveGameInfo_t *info = &pItem->m_SaveGameInfo;
|
||||
char sz[ 512 ];
|
||||
LoadBuffer.GetString( sz );
|
||||
LoadBuffer.GetString( sz, sizeof( sz ) );
|
||||
info->m_sCurrentSaveFile = sz;
|
||||
info->m_nCurrentSaveFileTime = LoadBuffer.GetInt();
|
||||
int c = LoadBuffer.GetInt();
|
||||
@@ -277,7 +277,7 @@ public:
|
||||
{
|
||||
Ep2LevelStats_t::GenericStatsLump_t data;
|
||||
char pchStatName[ 512 ];
|
||||
LoadBuffer.GetString( pchStatName );
|
||||
LoadBuffer.GetString( pchStatName, sizeof( pchStatName ) );
|
||||
LoadBuffer.Get( &data, sizeof( data ) );
|
||||
pItem->m_dictGeneric.Insert( pchStatName, data );
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ IterationRetval_t CFireSphere::EnumElement( IHandleEntity *pHandleEntity )
|
||||
int FireSystem_GetFiresInSphere( CFire **pList, int listMax, bool onlyActiveFires, const Vector &origin, float radius )
|
||||
{
|
||||
CFireSphere sphereEnum( pList, listMax, onlyActiveFires, origin, radius );
|
||||
::partition->EnumerateElementsInSphere( PARTITION_ENGINE_NON_STATIC_EDICTS, origin, radius, false, &sphereEnum );
|
||||
partition->EnumerateElementsInSphere( PARTITION_ENGINE_NON_STATIC_EDICTS, origin, radius, false, &sphereEnum );
|
||||
|
||||
return sphereEnum.GetCount();
|
||||
}
|
||||
|
||||
@@ -45,9 +45,8 @@ public:
|
||||
DECLARE_DATADESC();
|
||||
|
||||
private:
|
||||
bool UpdateState( void );
|
||||
|
||||
int m_state;
|
||||
bool UpdateState( void );
|
||||
int m_state;
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS( func_areaportal, CAreaPortal );
|
||||
|
||||
@@ -817,6 +817,8 @@ void CBreakable::VPhysicsCollision( int index, gamevcollisionevent_t *pEvent )
|
||||
//-----------------------------------------------------------------------------
|
||||
int CBreakable::OnTakeDamage( const CTakeDamageInfo &info )
|
||||
{
|
||||
Vector vecTemp;
|
||||
|
||||
CTakeDamageInfo subInfo = info;
|
||||
|
||||
// If attacker can't do at least the min required damage to us, don't take any damage from them
|
||||
@@ -830,6 +832,8 @@ int CBreakable::OnTakeDamage( const CTakeDamageInfo &info )
|
||||
return 1;
|
||||
}
|
||||
|
||||
vecTemp = subInfo.GetInflictor()->GetAbsOrigin() - WorldSpaceCenter();
|
||||
|
||||
if (!IsBreakable())
|
||||
return 0;
|
||||
|
||||
|
||||
@@ -109,6 +109,8 @@ void CWindowPane::PaneTouch( CBaseEntity *pOther )
|
||||
//------------------------------------------------------------------------------
|
||||
void CWindowPane::Die( void )
|
||||
{
|
||||
Vector flForce = -1 * GetAbsVelocity();
|
||||
|
||||
CPASFilter filter( GetAbsOrigin() );
|
||||
te->ShatterSurface( filter, 0.0,
|
||||
&GetAbsOrigin(), &GetAbsAngles(),
|
||||
|
||||
@@ -162,7 +162,7 @@ void CFunc_Dust::Spawn()
|
||||
|
||||
//Since keyvalues can arrive in any order, and UTIL_StringToColor32 stomps alpha,
|
||||
//install the alpha value here.
|
||||
color32 clr = { m_Color.m_Value.r, m_Color.m_Value.g, m_Color.m_Value.b, (byte)m_iAlpha };
|
||||
color32 clr = { m_Color.m_Value.r, m_Color.m_Value.g, m_Color.m_Value.b, (uint8)m_iAlpha };
|
||||
m_Color.Set( clr );
|
||||
|
||||
BaseClass::Spawn();
|
||||
|
||||
@@ -1931,10 +1931,10 @@ const char *CServerGameDLL::GetServerBrowserGameData()
|
||||
//-----------------------------------------------------------------------------
|
||||
void CServerGameDLL::Status( void (*print) (const char *fmt, ...) )
|
||||
{
|
||||
if ( g_pGameRules )
|
||||
/* if ( g_pGameRules )
|
||||
{
|
||||
g_pGameRules->Status( print );
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -1975,11 +1975,12 @@ IServerGameDLL::eCanProvideLevelResult CServerGameDLL::CanProvideLevel( /* in/ou
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CServerGameDLL::IsManualMapChangeOkay( const char **pszReason )
|
||||
{
|
||||
/*
|
||||
if ( GameRules() )
|
||||
{
|
||||
return GameRules()->IsManualMapChangeOkay( pszReason );
|
||||
}
|
||||
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -372,7 +372,7 @@ void CFlextalkActor::ProcessSceneEvents( void )
|
||||
{
|
||||
m_flexnum = LookupFlex( szTemp );
|
||||
|
||||
if (m_flexnum != LocalFlexController_t(-1) && m_flextarget[m_flexnum] != 1)
|
||||
if (m_flexnum != -1 && m_flextarget[m_flexnum] != 1)
|
||||
{
|
||||
m_flextarget[m_flexnum] = 1.0;
|
||||
// SetFlexTarget( m_flexnum );
|
||||
|
||||
@@ -131,7 +131,6 @@ public:
|
||||
entity.name = m_nameList.AddString( pGlobalname );
|
||||
entity.levelName = m_nameList.AddString( pMapName );
|
||||
entity.state = state;
|
||||
entity.counter = 0;
|
||||
|
||||
int index = GetIndex( m_nameList.String( entity.name ) );
|
||||
if ( index >= 0 )
|
||||
|
||||
@@ -289,7 +289,7 @@ bool CMultiManager::KeyValue( const char *szKeyName, const char *szValue )
|
||||
{
|
||||
char tmp[128];
|
||||
|
||||
UTIL_StripToken( szKeyName, tmp, Q_ARRAYSIZE( tmp ) );
|
||||
UTIL_StripToken( szKeyName, tmp );
|
||||
m_iTargetName [ m_cTargets ] = AllocPooledString( tmp );
|
||||
m_flTargetDelay [ m_cTargets ] = atof (szValue);
|
||||
m_cTargets++;
|
||||
|
||||
@@ -4015,8 +4015,8 @@ bool CNPC_Antlion::CorpseGib( const CTakeDamageInfo &info )
|
||||
}
|
||||
|
||||
Vector velocity = vec3_origin;
|
||||
AngularImpulse angVelocity = RandomAngularImpulse( -150, 150 );
|
||||
breakablepropparams_t params( EyePosition(), GetAbsAngles(), velocity, angVelocity );
|
||||
AngularImpulse angVelocity = RandomAngularImpulse( -150, 150 );
|
||||
static breakablepropparams_t params( EyePosition(), GetAbsAngles(), velocity, angVelocity );
|
||||
params.impactEnergyScale = 1.0f;
|
||||
params.defBurstScale = 150.0f;
|
||||
params.defCollisionGroup = COLLISION_GROUP_DEBRIS;
|
||||
|
||||
@@ -1968,7 +1968,7 @@ void CNPC_Barnacle::OnTongueTipUpdated()
|
||||
//-----------------------------------------------------------------------------
|
||||
void CNPC_Barnacle::UpdateTongue( void )
|
||||
{
|
||||
if ( m_hTongueTip == NULL )
|
||||
if ( m_hTongueTip == NULL || m_hTongueTip->m_pSpring == NULL )
|
||||
return;
|
||||
|
||||
// Set the spring's length to that of the tongue's extension
|
||||
|
||||
@@ -143,23 +143,23 @@ struct citizen_expression_list_t
|
||||
// Scared
|
||||
citizen_expression_list_t ScaredExpressions[STATES_WITH_EXPRESSIONS] =
|
||||
{
|
||||
{ { "scenes/Expressions/citizen_scared_idle_01.vcd" } },
|
||||
{ { "scenes/Expressions/citizen_scared_alert_01.vcd" } },
|
||||
{ { "scenes/Expressions/citizen_scared_combat_01.vcd" } },
|
||||
{ "scenes/Expressions/citizen_scared_idle_01.vcd" },
|
||||
{ "scenes/Expressions/citizen_scared_alert_01.vcd" },
|
||||
{ "scenes/Expressions/citizen_scared_combat_01.vcd" },
|
||||
};
|
||||
// Normal
|
||||
citizen_expression_list_t NormalExpressions[STATES_WITH_EXPRESSIONS] =
|
||||
{
|
||||
{ { "scenes/Expressions/citizen_normal_idle_01.vcd" } },
|
||||
{ { "scenes/Expressions/citizen_normal_alert_01.vcd" } },
|
||||
{ { "scenes/Expressions/citizen_normal_combat_01.vcd" } },
|
||||
{ "scenes/Expressions/citizen_normal_idle_01.vcd" },
|
||||
{ "scenes/Expressions/citizen_normal_alert_01.vcd" },
|
||||
{ "scenes/Expressions/citizen_normal_combat_01.vcd" },
|
||||
};
|
||||
// Angry
|
||||
citizen_expression_list_t AngryExpressions[STATES_WITH_EXPRESSIONS] =
|
||||
{
|
||||
{ { "scenes/Expressions/citizen_angry_idle_01.vcd" } },
|
||||
{ { "scenes/Expressions/citizen_angry_alert_01.vcd" } },
|
||||
{ { "scenes/Expressions/citizen_angry_combat_01.vcd" } },
|
||||
{ "scenes/Expressions/citizen_angry_idle_01.vcd" },
|
||||
{ "scenes/Expressions/citizen_angry_alert_01.vcd" },
|
||||
{ "scenes/Expressions/citizen_angry_combat_01.vcd" },
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -4197,6 +4197,8 @@ void CNPC_Citizen::AddInsignia()
|
||||
|
||||
void CNPC_Citizen::RemoveInsignia()
|
||||
{
|
||||
// This is crap right now.
|
||||
CBaseEntity *FirstEnt();
|
||||
CBaseEntity *pEntity = gEntList.FirstEnt();
|
||||
|
||||
while( pEntity )
|
||||
|
||||
@@ -2612,7 +2612,7 @@ void CNPC_MetroPolice::IdleSound( void )
|
||||
|
||||
if ( m_Sentences.Speak( pQuestion[bIsCriminal][nQuestionType] ) >= 0 )
|
||||
{
|
||||
GetSquad()->BroadcastInteraction( g_interactionMetrocopIdleChatter, (void*)(METROPOLICE_CHATTER_RESPONSE + nQuestionType), this );
|
||||
GetSquad()->BroadcastInteraction( g_interactionMetrocopIdleChatter, (void*)(intp)(METROPOLICE_CHATTER_RESPONSE + nQuestionType), this );
|
||||
m_nIdleChatterType = METROPOLICE_CHATTER_WAIT_FOR_RESPONSE;
|
||||
}
|
||||
}
|
||||
@@ -2983,7 +2983,7 @@ bool CNPC_MetroPolice::HandleInteraction(int interactionType, void *data, CBaseC
|
||||
|
||||
if ( interactionType == g_interactionMetrocopIdleChatter )
|
||||
{
|
||||
m_nIdleChatterType = (int)data;
|
||||
m_nIdleChatterType = (intp)data;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -3538,7 +3538,7 @@ void CNPC_PlayerCompanion::InputClearAllOuputs( inputdata_t &inputdata )
|
||||
typedescription_t *dataDesc = &dmap->dataDesc[i];
|
||||
if ( ( dataDesc->fieldType == FIELD_CUSTOM ) && ( dataDesc->flags & FTYPEDESC_OUTPUT ) )
|
||||
{
|
||||
CBaseEntityOutput *pOutput = (CBaseEntityOutput *)((int)this + (int)dataDesc->fieldOffset[0]);
|
||||
CBaseEntityOutput *pOutput = (CBaseEntityOutput *)((intp)this + (intp)dataDesc->fieldOffset[0]);
|
||||
pOutput->DeleteAllElements();
|
||||
/*
|
||||
int nConnections = pOutput->NumberOfElements();
|
||||
|
||||
@@ -1988,7 +1988,7 @@ void CNPC_CScanner::BlindFlashTarget( CBaseEntity *pTarget )
|
||||
|
||||
if ( tr.startsolid == false && tr.fraction == 1.0)
|
||||
{
|
||||
color32 white = { 255, 255, 255, (byte)(SCANNER_FLASH_MAX_VALUE * dotPr) };
|
||||
color32 white = { 255, 255, 255, (uint8)(SCANNER_FLASH_MAX_VALUE * dotPr) };
|
||||
|
||||
if ( ( g_pMaterialSystemHardwareConfig != NULL ) && ( g_pMaterialSystemHardwareConfig->GetHDRType() != HDR_TYPE_NONE ) )
|
||||
{
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
virtual void FireBullets ( const FireBulletsInfo_t &info );
|
||||
virtual bool Weapon_Switch( CBaseCombatWeapon *pWeapon, int viewmodelindex = 0);
|
||||
virtual bool BumpWeapon( CBaseCombatWeapon *pWeapon );
|
||||
virtual void ChangeTeam( int iTeam ) OVERRIDE;
|
||||
virtual void ChangeTeam( int iTeam );
|
||||
virtual void PickupObject ( CBaseEntity *pObject, bool bLimitMassAndSize );
|
||||
virtual void PlayStepSound( Vector &vecOrigin, surfacedata_t *psurface, float fvol, bool force );
|
||||
virtual void Weapon_Drop( CBaseCombatWeapon *pWeapon, const Vector *pvecTarget = NULL, const Vector *pVelocity = NULL );
|
||||
|
||||
@@ -23,7 +23,6 @@ public:
|
||||
// Called during player movement to set up/restore after lag compensation
|
||||
virtual void StartLagCompensation( CBasePlayer *player, CUserCmd *cmd ) = 0;
|
||||
virtual void FinishLagCompensation( CBasePlayer *player ) = 0;
|
||||
virtual bool IsCurrentlyDoingLagCompensation() const = 0;
|
||||
};
|
||||
|
||||
extern ILagCompensationManager *lagcompensation;
|
||||
|
||||
@@ -150,8 +150,8 @@ void PointCameraSetupVisibility( CBaseEntity *pPlayer, int area, unsigned char *
|
||||
pCameraEnt->SetActive( false );
|
||||
}
|
||||
|
||||
int nNext;
|
||||
for ( int i = g_InfoCameraLinkList.Head(); i != g_InfoCameraLinkList.InvalidIndex(); i = nNext )
|
||||
intp nNext;
|
||||
for ( intp i = g_InfoCameraLinkList.Head(); i != g_InfoCameraLinkList.InvalidIndex(); i = nNext )
|
||||
{
|
||||
nNext = g_InfoCameraLinkList.Next( i );
|
||||
|
||||
|
||||
@@ -18,12 +18,6 @@
|
||||
#include "hl2mp_gamerules.h"
|
||||
#endif
|
||||
|
||||
#ifdef TF_DLL
|
||||
#include "tf_player.h"
|
||||
#include "entity_healthkit.h"
|
||||
#include "particle_parse.h"
|
||||
#endif
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
|
||||
@@ -369,17 +363,6 @@ bool UTIL_ItemCanBeTouchedByPlayer( CBaseEntity *pItem, CBasePlayer *pPlayer )
|
||||
vecStartPos = pItem->CollisionProp()->WorldSpaceCenter();
|
||||
}
|
||||
|
||||
#ifdef TF_DLL
|
||||
//Plague powerup carrier collects health kits in a radius so we want to skip the occlusion trace
|
||||
CTFPlayer *pTFPlayer = dynamic_cast<CTFPlayer*>( pPlayer );
|
||||
if ( pTFPlayer && ( pTFPlayer->m_Shared.GetCarryingRuneType() == RUNE_PLAGUE ) )
|
||||
{
|
||||
CHealthKit *pHealthKit = dynamic_cast<CHealthKit*>( pItem );
|
||||
if ( pHealthKit )
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
Vector vecEndPos = pPlayer->EyePosition();
|
||||
|
||||
// FIXME: This is the simple first try solution towards the problem. We need to take edges and shape more into account
|
||||
@@ -451,18 +434,6 @@ void CItem::ItemTouch( CBaseEntity *pOther )
|
||||
{
|
||||
m_OnPlayerTouch.FireOutput(pOther, this);
|
||||
|
||||
#if TF_DLL
|
||||
CHealthKit *pHealthKit = dynamic_cast<CHealthKit*>( this );
|
||||
if ( pHealthKit )
|
||||
{
|
||||
CTFPlayer *pTFPlayer = ToTFPlayer( pPlayer );
|
||||
if ( pTFPlayer && ( pTFPlayer->m_Shared.GetCarryingRuneType() == RUNE_PLAGUE ) )
|
||||
{
|
||||
DispatchParticleEffect( "plague_healthkit_pickup", GetAbsOrigin(), GetAbsAngles() );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
SetTouch( NULL );
|
||||
SetThink( NULL );
|
||||
|
||||
|
||||
+1
-2
@@ -82,10 +82,9 @@ public:
|
||||
DECLARE_DATADESC();
|
||||
protected:
|
||||
virtual void ComeToRest( void );
|
||||
bool m_bActivateWhenAtRest;
|
||||
|
||||
private:
|
||||
|
||||
bool m_bActivateWhenAtRest;
|
||||
COutputEvent m_OnPlayerTouch;
|
||||
COutputEvent m_OnCacheInteraction;
|
||||
|
||||
|
||||
+15
-15
@@ -103,8 +103,8 @@ static int __cdecl CompareSpawnOrder(HierarchicalSpawn_t *pEnt1, HierarchicalSpa
|
||||
{
|
||||
if ( g_pClassnameSpawnPriority )
|
||||
{
|
||||
int o1 = pEnt1->m_hEntity ? g_pClassnameSpawnPriority->GetStringID( pEnt1->m_hEntity->GetClassname() ) : -1;
|
||||
int o2 = pEnt2->m_hEntity ? g_pClassnameSpawnPriority->GetStringID( pEnt2->m_hEntity->GetClassname() ) : -1;
|
||||
int o1 = pEnt1->m_pEntity ? g_pClassnameSpawnPriority->GetStringID( pEnt1->m_pEntity->GetClassname() ) : -1;
|
||||
int o2 = pEnt2->m_pEntity ? g_pClassnameSpawnPriority->GetStringID( pEnt2->m_pEntity->GetClassname() ) : -1;
|
||||
if ( o1 < o2 )
|
||||
return 1;
|
||||
if ( o2 < o1 )
|
||||
@@ -152,7 +152,7 @@ static void ComputeSpawnHierarchyDepth( int nEntities, HierarchicalSpawn_t *pSpa
|
||||
int nEntity;
|
||||
for (nEntity = 0; nEntity < nEntities; nEntity++)
|
||||
{
|
||||
CBaseEntity *pEntity = pSpawnList[nEntity].m_hEntity;
|
||||
CBaseEntity *pEntity = pSpawnList[nEntity].m_pEntity;
|
||||
if (pEntity && !pEntity->IsDormant())
|
||||
{
|
||||
pSpawnList[nEntity].m_nDepth = ComputeSpawnHierarchyDepth_r( pEntity );
|
||||
@@ -202,7 +202,7 @@ void SetupParentsForSpawnList( int nEntities, HierarchicalSpawn_t *pSpawnList )
|
||||
int nEntity;
|
||||
for (nEntity = nEntities - 1; nEntity >= 0; nEntity--)
|
||||
{
|
||||
CBaseEntity *pEntity = pSpawnList[nEntity].m_hEntity;
|
||||
CBaseEntity *pEntity = pSpawnList[nEntity].m_pEntity;
|
||||
if ( pEntity )
|
||||
{
|
||||
if ( strchr(STRING(pEntity->m_iParent), ',') )
|
||||
@@ -234,7 +234,7 @@ void RememberInitialEntityPositions( int nEntities, HierarchicalSpawn_t *pSpawnL
|
||||
{
|
||||
for (int nEntity = 0; nEntity < nEntities; nEntity++)
|
||||
{
|
||||
CBaseEntity *pEntity = pSpawnList[nEntity].m_hEntity;
|
||||
CBaseEntity *pEntity = pSpawnList[nEntity].m_pEntity;
|
||||
|
||||
if ( pEntity )
|
||||
{
|
||||
@@ -250,7 +250,7 @@ void SpawnAllEntities( int nEntities, HierarchicalSpawn_t *pSpawnList, bool bAct
|
||||
for (nEntity = 0; nEntity < nEntities; nEntity++)
|
||||
{
|
||||
VPROF( "MapEntity_ParseAllEntities_Spawn");
|
||||
CBaseEntity *pEntity = pSpawnList[nEntity].m_hEntity;
|
||||
CBaseEntity *pEntity = pSpawnList[nEntity].m_pEntity;
|
||||
|
||||
if ( pSpawnList[nEntity].m_pDeferredParent )
|
||||
{
|
||||
@@ -272,15 +272,15 @@ void SpawnAllEntities( int nEntities, HierarchicalSpawn_t *pSpawnList, bool bAct
|
||||
for ( int i = nEntity+1; i < nEntities; i++ )
|
||||
{
|
||||
// this is a child object that will be deleted now
|
||||
if ( pSpawnList[i].m_hEntity && pSpawnList[i].m_hEntity->IsMarkedForDeletion() )
|
||||
if ( pSpawnList[i].m_pEntity && pSpawnList[i].m_pEntity->IsMarkedForDeletion() )
|
||||
{
|
||||
pSpawnList[i].m_hEntity = NULL;
|
||||
pSpawnList[i].m_pEntity = NULL;
|
||||
}
|
||||
}
|
||||
// Spawn failed.
|
||||
gEntList.CleanupDeleteList();
|
||||
// Remove the entity from the spawn list
|
||||
pSpawnList[nEntity].m_hEntity = NULL;
|
||||
pSpawnList[nEntity].m_pEntity = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -291,7 +291,7 @@ void SpawnAllEntities( int nEntities, HierarchicalSpawn_t *pSpawnList, bool bAct
|
||||
bool bAsyncAnims = mdlcache->SetAsyncLoad( MDLCACHE_ANIMBLOCK, false );
|
||||
for (nEntity = 0; nEntity < nEntities; nEntity++)
|
||||
{
|
||||
CBaseEntity *pEntity = pSpawnList[nEntity].m_hEntity;
|
||||
CBaseEntity *pEntity = pSpawnList[nEntity].m_pEntity;
|
||||
|
||||
if ( pEntity )
|
||||
{
|
||||
@@ -368,7 +368,7 @@ void MapEntity_ParseAllEntities(const char *pMapData, IMapEntityFilter *pFilter,
|
||||
continue;
|
||||
}
|
||||
|
||||
// To
|
||||
// To
|
||||
if ( dynamic_cast<CWorld*>( pEntity ) )
|
||||
{
|
||||
VPROF( "MapEntity_ParseAllEntities_SpawnWorld");
|
||||
@@ -378,7 +378,7 @@ void MapEntity_ParseAllEntities(const char *pMapData, IMapEntityFilter *pFilter,
|
||||
DispatchSpawn(pEntity);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
CNodeEnt *pNode = dynamic_cast<CNodeEnt*>(pEntity);
|
||||
if ( pNode )
|
||||
{
|
||||
@@ -423,7 +423,7 @@ void MapEntity_ParseAllEntities(const char *pMapData, IMapEntityFilter *pFilter,
|
||||
else
|
||||
{
|
||||
// Queue up this entity for spawning
|
||||
pSpawnList[nEntities].m_hEntity = pEntity;
|
||||
pSpawnList[nEntities].m_pEntity = pEntity;
|
||||
pSpawnList[nEntities].m_nDepth = 0;
|
||||
pSpawnList[nEntities].m_pDeferredParentAttachment = NULL;
|
||||
pSpawnList[nEntities].m_pDeferredParent = NULL;
|
||||
@@ -459,7 +459,7 @@ void MapEntity_ParseAllEntities(const char *pMapData, IMapEntityFilter *pFilter,
|
||||
CBaseEntity *pEntity = pPointTemplate->GetTemplateEntity( iTemplateNum );
|
||||
for ( int iEntNum = 0; iEntNum < nEntities; iEntNum++ )
|
||||
{
|
||||
if ( pSpawnList[iEntNum].m_hEntity == pEntity )
|
||||
if ( pSpawnList[iEntNum].m_pEntity == pEntity )
|
||||
{
|
||||
// Give the point_template the mapdata
|
||||
pPointTemplate->AddTemplate( pEntity, pSpawnMapData[iEntNum].m_pMapData, pSpawnMapData[iEntNum].m_iMapDataLength );
|
||||
@@ -471,7 +471,7 @@ void MapEntity_ParseAllEntities(const char *pMapData, IMapEntityFilter *pFilter,
|
||||
gEntList.CleanupDeleteList();
|
||||
|
||||
// Remove the entity from the spawn list
|
||||
pSpawnList[iEntNum].m_hEntity = NULL;
|
||||
pSpawnList[iEntNum].m_pEntity = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ void MapEntity_PrecacheEntity( const char *pEntData, int &nStringSize );
|
||||
//-----------------------------------------------------------------------------
|
||||
struct HierarchicalSpawn_t
|
||||
{
|
||||
CHandle<CBaseEntity> m_hEntity;
|
||||
CBaseEntity *m_pEntity;
|
||||
int m_nDepth;
|
||||
CBaseEntity *m_pDeferredParent; // attachment parents can't be set until the parents are spawned
|
||||
const char *m_pDeferredParentAttachment; // so defer setting them up until the second pass
|
||||
|
||||
@@ -619,7 +619,8 @@ bool CGamePlayerEquip::KeyValue( const char *szKeyName, const char *szValue )
|
||||
if ( !m_weaponNames[i] )
|
||||
{
|
||||
char tmp[128];
|
||||
UTIL_StripToken( szKeyName, tmp, Q_ARRAYSIZE( tmp ) );
|
||||
|
||||
UTIL_StripToken( szKeyName, tmp );
|
||||
|
||||
m_weaponNames[i] = AllocPooledString(tmp);
|
||||
m_weaponCount[i] = atoi(szValue);
|
||||
|
||||
@@ -191,7 +191,7 @@ void CFuncBrush::TurnOn( void )
|
||||
}
|
||||
|
||||
|
||||
bool CFuncBrush::IsOn( void ) const
|
||||
bool CFuncBrush::IsOn( void )
|
||||
{
|
||||
return !IsEffectActive( EF_NODRAW );
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: basic solid geometry
|
||||
// enabled state: brush is visible
|
||||
// disabled state: brush not visible
|
||||
// disabled staute: brush not visible
|
||||
//-----------------------------------------------------------------------------
|
||||
class CFuncBrush : public CBaseEntity
|
||||
{
|
||||
@@ -32,8 +32,8 @@ public:
|
||||
|
||||
virtual int DrawDebugTextOverlays( void );
|
||||
|
||||
virtual void TurnOff( void );
|
||||
virtual void TurnOn( void );
|
||||
void TurnOff( void );
|
||||
void TurnOn( void );
|
||||
|
||||
// Input handlers
|
||||
void InputTurnOff( inputdata_t &inputdata );
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
|
||||
DECLARE_DATADESC();
|
||||
|
||||
virtual bool IsOn( void ) const;
|
||||
virtual bool IsOn( void );
|
||||
};
|
||||
|
||||
|
||||
|
||||
+4
-4
@@ -334,11 +334,11 @@ inline void DirectionToVector2D( NavDirType dir, Vector2D *v )
|
||||
{
|
||||
switch( dir )
|
||||
{
|
||||
default: Assert(0);
|
||||
case NORTH: v->x = 0.0f; v->y = -1.0f; break;
|
||||
case SOUTH: v->x = 0.0f; v->y = 1.0f; break;
|
||||
case EAST: v->x = 1.0f; v->y = 0.0f; break;
|
||||
case WEST: v->x = -1.0f; v->y = 0.0f; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,11 +348,11 @@ inline void CornerToVector2D( NavCornerType dir, Vector2D *v )
|
||||
{
|
||||
switch( dir )
|
||||
{
|
||||
default: Assert(0);
|
||||
case NORTH_WEST: v->x = -1.0f; v->y = -1.0f; break;
|
||||
case NORTH_EAST: v->x = 1.0f; v->y = -1.0f; break;
|
||||
case SOUTH_EAST: v->x = 1.0f; v->y = 1.0f; break;
|
||||
case SOUTH_WEST: v->x = -1.0f; v->y = 1.0f; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
v->NormalizeInPlace();
|
||||
@@ -365,8 +365,6 @@ inline void GetCornerTypesInDirection( NavDirType dir, NavCornerType *first, Nav
|
||||
{
|
||||
switch ( dir )
|
||||
{
|
||||
default:
|
||||
Assert(0);
|
||||
case NORTH:
|
||||
*first = NORTH_WEST;
|
||||
*second = NORTH_EAST;
|
||||
@@ -383,6 +381,8 @@ inline void GetCornerTypesInDirection( NavDirType dir, NavCornerType *first, Nav
|
||||
*first = NORTH_WEST;
|
||||
*second = SOUTH_WEST;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+10
-11
@@ -192,8 +192,6 @@ CNavArea::CNavArea( void )
|
||||
m_avoidanceObstacleHeight = 0.0f;
|
||||
|
||||
m_totalCost = 0.0f;
|
||||
m_costSoFar = 0.0f;
|
||||
m_pathLengthSoFar = 0.0f;
|
||||
|
||||
ResetNodes();
|
||||
|
||||
@@ -246,8 +244,6 @@ CNavArea::CNavArea( void )
|
||||
m_isInheritedFrom = false;
|
||||
|
||||
m_funcNavCostVector.RemoveAll();
|
||||
|
||||
m_nVisTestCounter = (uint32)-1;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
@@ -3385,10 +3381,16 @@ void CNavArea::AddToOpenList( void )
|
||||
}
|
||||
|
||||
// insert self in ascending cost order
|
||||
// Since costs are positive, IEEE754 let's us compare as integers (see http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm)
|
||||
CNavArea *area, *last = NULL;
|
||||
int thisCostBits = *reinterpret_cast<const int *>(&m_totalCost);
|
||||
|
||||
Assert ( m_totalCost >= 0.0f );
|
||||
for( area = m_openList; area; area = area->m_nextOpen )
|
||||
{
|
||||
if ( GetTotalCost() < area->GetTotalCost() )
|
||||
Assert ( area->GetTotalCost() >= 0.0f );
|
||||
int thoseCostBits = *reinterpret_cast<const int *>(&area->m_totalCost);
|
||||
if ( thisCostBits < thoseCostBits )
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -3707,7 +3709,7 @@ static Vector FindPositionInArea( CNavArea *area, NavCornerType corner )
|
||||
pos = cornerPos + Vector( area->GetSizeX()*0.5f*multX, area->GetSizeY()*0.5f*multY, 0.0f );
|
||||
if ( !area->IsOverlapping( pos ) )
|
||||
{
|
||||
AssertMsg( false, "A Hiding Spot can't be placed on its area at (%.0f %.0f %.0f)", cornerPos.x, cornerPos.y, cornerPos.z );
|
||||
AssertMsg( false, UTIL_VarArgs( "A Hiding Spot can't be placed on its area at (%.0f %.0f %.0f)", cornerPos.x, cornerPos.y, cornerPos.z) );
|
||||
|
||||
// Just pull the position to a small offset
|
||||
pos = cornerPos + Vector( 1.0f*multX, 1.0f*multY, 0.0f );
|
||||
@@ -4285,9 +4287,6 @@ bool CNavArea::ComputeLighting( void )
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
CON_COMMAND_F( nav_update_lighting, "Recomputes lighting values", FCVAR_CHEAT )
|
||||
{
|
||||
if ( !UTIL_IsCommandIssuedByServerAdmin() )
|
||||
return;
|
||||
|
||||
int numComputed = 0;
|
||||
if ( args.ArgC() == 2 )
|
||||
{
|
||||
@@ -5631,7 +5630,7 @@ void CNavArea::ComputeVisibilityToMesh( void )
|
||||
/**
|
||||
* The center and all four corners must ALL be visible
|
||||
*/
|
||||
bool CNavArea::IsEntirelyVisible( const Vector &eye, const CBaseEntity *ignore ) const
|
||||
bool CNavArea::IsEntirelyVisible( const Vector &eye, CBaseEntity *ignore ) const
|
||||
{
|
||||
Vector corner;
|
||||
trace_t result;
|
||||
@@ -5664,7 +5663,7 @@ bool CNavArea::IsEntirelyVisible( const Vector &eye, const CBaseEntity *ignore )
|
||||
/**
|
||||
* The center or any of the four corners may be visible
|
||||
*/
|
||||
bool CNavArea::IsPartiallyVisible( const Vector &eye, const CBaseEntity *ignore ) const
|
||||
bool CNavArea::IsPartiallyVisible( const Vector &eye, CBaseEntity *ignore ) const
|
||||
{
|
||||
Vector corner;
|
||||
trace_t result;
|
||||
|
||||
+18
-22
@@ -18,15 +18,6 @@
|
||||
// BOTPORT: Clean up relationship between team index and danger storage in nav areas
|
||||
enum { MAX_NAV_TEAMS = 2 };
|
||||
|
||||
#ifdef STAGING_ONLY
|
||||
inline void DebuggerBreakOnNaN_StagingOnly( float val )
|
||||
{
|
||||
if ( IS_NAN( val ) )
|
||||
DebuggerBreak();
|
||||
}
|
||||
#else
|
||||
#define DebuggerBreakOnNaN_StagingOnly( _val )
|
||||
#endif
|
||||
|
||||
class CFuncElevator;
|
||||
class CFuncNavPrerequisite;
|
||||
@@ -343,8 +334,8 @@ public:
|
||||
bool IsOverlapping( const Extent &extent ) const; // return true if 'extent' overlaps our 2D extents
|
||||
bool IsOverlappingX( const CNavArea *area ) const; // return true if 'area' overlaps our X extent
|
||||
bool IsOverlappingY( const CNavArea *area ) const; // return true if 'area' overlaps our Y extent
|
||||
inline float GetZ( const Vector * RESTRICT pPos ) const RESTRICT ; // return Z of area at (x,y) of 'pos'
|
||||
inline float GetZ( const Vector &pos ) const RESTRICT; // return Z of area at (x,y) of 'pos'
|
||||
inline float GetZ( const Vector * RESTRICT pPos ) const ; // return Z of area at (x,y) of 'pos'
|
||||
inline float GetZ( const Vector &pos ) const; // return Z of area at (x,y) of 'pos'
|
||||
float GetZ( float x, float y ) const RESTRICT; // return Z of area at (x,y) of 'pos'
|
||||
bool Contains( const Vector &pos ) const; // return true if given point is on or above this area, but no others
|
||||
bool Contains( const CNavArea *area ) const;
|
||||
@@ -454,14 +445,14 @@ public:
|
||||
|
||||
static void ClearSearchLists( void ); // clears the open and closed lists for a new search
|
||||
|
||||
void SetTotalCost( float value ) { DebuggerBreakOnNaN_StagingOnly( value ); Assert( value >= 0.0 && !IS_NAN(value) ); m_totalCost = value; }
|
||||
float GetTotalCost( void ) const { DebuggerBreakOnNaN_StagingOnly( m_totalCost ); return m_totalCost; }
|
||||
void SetTotalCost( float value ) { Assert( value >= 0.0 && !IS_NAN(value) ); m_totalCost = value; }
|
||||
float GetTotalCost( void ) const { return m_totalCost; }
|
||||
|
||||
void SetCostSoFar( float value ) { DebuggerBreakOnNaN_StagingOnly( value ); Assert( value >= 0.0 && !IS_NAN(value) ); m_costSoFar = value; }
|
||||
float GetCostSoFar( void ) const { DebuggerBreakOnNaN_StagingOnly( m_costSoFar ); return m_costSoFar; }
|
||||
void SetCostSoFar( float value ) { Assert( value >= 0.0 && !IS_NAN(value) ); m_costSoFar = value; }
|
||||
float GetCostSoFar( void ) const { return m_costSoFar; }
|
||||
|
||||
void SetPathLengthSoFar( float value ) { DebuggerBreakOnNaN_StagingOnly( value ); Assert( value >= 0.0 && !IS_NAN(value) ); m_pathLengthSoFar = value; }
|
||||
float GetPathLengthSoFar( void ) const { DebuggerBreakOnNaN_StagingOnly( m_pathLengthSoFar ); return m_pathLengthSoFar; }
|
||||
void SetPathLengthSoFar( float value ) { Assert( value >= 0.0 && !IS_NAN(value) ); m_pathLengthSoFar = value; }
|
||||
float GetPathLengthSoFar( void ) const { return m_pathLengthSoFar; }
|
||||
|
||||
//- editing -----------------------------------------------------------------------------------------
|
||||
virtual void Draw( void ) const; // draw area for debugging & editing
|
||||
@@ -524,8 +515,8 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
virtual bool IsEntirelyVisible( const Vector &eye, const CBaseEntity *ignore = NULL ) const; // return true if entire area is visible from given eyepoint (CPU intensive)
|
||||
virtual bool IsPartiallyVisible( const Vector &eye, const CBaseEntity *ignore = NULL ) const; // return true if any portion of the area is visible from given eyepoint (CPU intensive)
|
||||
virtual bool IsEntirelyVisible( const Vector &eye, CBaseEntity *ignore = NULL ) const; // return true if entire area is visible from given eyepoint (CPU intensive)
|
||||
virtual bool IsPartiallyVisible( const Vector &eye, CBaseEntity *ignore = NULL ) const; // return true if any portion of the area is visible from given eyepoint (CPU intensive)
|
||||
|
||||
virtual bool IsPotentiallyVisible( const CNavArea *area ) const; // return true if given area is potentially visible from somewhere in this area (very fast)
|
||||
virtual bool IsPotentiallyVisibleToTeam( int team ) const; // return true if any portion of this area is visible to anyone on the given team (very fast)
|
||||
@@ -823,9 +814,14 @@ inline bool CNavArea::IsDegenerate( void ) const
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
inline CNavArea *CNavArea::GetAdjacentArea( NavDirType dir, int i ) const
|
||||
{
|
||||
if ( ( i < 0 ) || ( i >= m_connect[dir].Count() ) )
|
||||
return NULL;
|
||||
return m_connect[dir][i].area;
|
||||
for( int iter = 0; iter < m_connect[dir].Count(); ++iter )
|
||||
{
|
||||
if (i == 0)
|
||||
return m_connect[dir][iter].area;
|
||||
--i;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -91,7 +91,8 @@ void CFuncNavCost::Spawn( void )
|
||||
// chop space-delimited string into individual tokens
|
||||
if ( tags )
|
||||
{
|
||||
char *buffer = V_strdup ( tags );
|
||||
char *buffer = new char [ strlen( tags ) + 1 ];
|
||||
Q_strcpy( buffer, tags );
|
||||
|
||||
for( char *token = strtok( buffer, " " ); token; token = strtok( NULL, " " ) )
|
||||
{
|
||||
@@ -397,10 +398,7 @@ int CFuncNavBlocker::DrawDebugTextOverlays( void )
|
||||
CNavArea *area = collector.m_area[i];
|
||||
Extent areaExtent;
|
||||
area->GetExtent( &areaExtent );
|
||||
if ( debugoverlay )
|
||||
{
|
||||
debugoverlay->AddBoxOverlay( vec3_origin, areaExtent.lo, areaExtent.hi, vec3_angle, 0, 255, 0, 10, NDEBUG_PERSIST_TILL_NEXT_SERVER );
|
||||
}
|
||||
debugoverlay->AddBoxOverlay( vec3_origin, areaExtent.lo, areaExtent.hi, vec3_angle, 0, 255, 0, 10, NDEBUG_PERSIST_TILL_NEXT_SERVER );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+48
-61
@@ -14,10 +14,6 @@
|
||||
#include "gamerules.h"
|
||||
#include "datacache/imdlcache.h"
|
||||
|
||||
#include "tier2/tier2.h"
|
||||
#include "tier2/p4helpers.h"
|
||||
#include "tier2/fileutils.h"
|
||||
|
||||
#ifdef TERROR
|
||||
#include "func_elevator.h"
|
||||
#endif
|
||||
@@ -183,7 +179,6 @@ PlaceDirectory placeDirectory;
|
||||
#else
|
||||
#define FORMAT_BSPFILE "maps\\%s.bsp"
|
||||
#define FORMAT_NAVFILE "maps\\%s.nav"
|
||||
#define PATH_NAVFILE_EMBEDDED "maps\\embed.nav"
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
@@ -1190,13 +1185,6 @@ bool CNavMesh::Save( void ) const
|
||||
//
|
||||
SaveCustomData( fileBuffer );
|
||||
|
||||
if ( p4 )
|
||||
{
|
||||
char szCorrectPath[MAX_PATH];
|
||||
filesystem->GetCaseCorrectFullPath( filename, szCorrectPath );
|
||||
CP4AutoEditAddFile a( szCorrectPath );
|
||||
}
|
||||
|
||||
if ( !filesystem->WriteFile( filename, "MOD", fileBuffer ) )
|
||||
{
|
||||
Warning( "Unable to save %d bytes to %s\n", fileBuffer.Size(), filename );
|
||||
@@ -1319,9 +1307,25 @@ const CUtlVector< Place > *CNavMesh::GetPlacesFromNavFile( bool *hasUnnamedPlace
|
||||
Q_snprintf( filename, sizeof( filename ), FORMAT_NAVFILE, STRING( gpGlobals->mapname ) );
|
||||
|
||||
CUtlBuffer fileBuffer( 4096, 1024*1024, CUtlBuffer::READ_ONLY );
|
||||
if ( GetNavDataFromFile( fileBuffer ) != NAV_OK )
|
||||
if ( !filesystem->ReadFile( filename, "GAME", fileBuffer ) ) // this ignores .nav files embedded in the .bsp ...
|
||||
{
|
||||
return NULL;
|
||||
if ( !filesystem->ReadFile( filename, "BSP", fileBuffer ) ) // ... and this looks for one if it's the only one around.
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if ( IsX360() )
|
||||
{
|
||||
// 360 has compressed NAVs
|
||||
CLZMA lzma;
|
||||
if ( lzma.IsCompressed( (unsigned char *)fileBuffer.Base() ) )
|
||||
{
|
||||
int originalSize = lzma.GetActualSize( (unsigned char *)fileBuffer.Base() );
|
||||
unsigned char *pOriginalData = new unsigned char[originalSize];
|
||||
lzma.Uncompress( (unsigned char *)fileBuffer.Base(), pOriginalData );
|
||||
fileBuffer.AssumeMemory( pOriginalData, originalSize, originalSize, CUtlBuffer::READ_ONLY );
|
||||
}
|
||||
}
|
||||
|
||||
// check magic number
|
||||
@@ -1371,46 +1375,6 @@ const CUtlVector< Place > *CNavMesh::GetPlacesFromNavFile( bool *hasUnnamedPlace
|
||||
return placeDirectory.GetPlaces();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Fetch raw nav data into buffer
|
||||
*/
|
||||
NavErrorType CNavMesh::GetNavDataFromFile( CUtlBuffer &outBuffer, bool *pNavDataFromBSP )
|
||||
{
|
||||
// nav filename is derived from map filename
|
||||
char filename[MAX_PATH] = { 0 };
|
||||
Q_snprintf( filename, sizeof( filename ), FORMAT_NAVFILE, STRING( gpGlobals->mapname ) );
|
||||
|
||||
if ( !filesystem->ReadFile( filename, "MOD", outBuffer ) ) // this ignores .nav files embedded in the .bsp ...
|
||||
{
|
||||
if ( !filesystem->ReadFile( filename, "BSP", outBuffer ) ) // ... and this looks for one if it's the only one around.
|
||||
{
|
||||
// Finally, check for the special embed name for in-BSP nav meshes only
|
||||
if ( !filesystem->ReadFile( PATH_NAVFILE_EMBEDDED, "BSP", outBuffer ) )
|
||||
{
|
||||
return NAV_CANT_ACCESS_FILE;
|
||||
}
|
||||
}
|
||||
if ( pNavDataFromBSP )
|
||||
{
|
||||
*pNavDataFromBSP = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( IsX360() )
|
||||
{
|
||||
// 360 has compressed NAVs
|
||||
if ( CLZMA::IsCompressed( (unsigned char *)outBuffer.Base() ) )
|
||||
{
|
||||
int originalSize = CLZMA::GetActualSize( (unsigned char *)outBuffer.Base() );
|
||||
unsigned char *pOriginalData = new unsigned char[originalSize];
|
||||
CLZMA::Uncompress( (unsigned char *)outBuffer.Base(), pOriginalData );
|
||||
outBuffer.AssumeMemory( pOriginalData, originalSize, originalSize, CUtlBuffer::READ_ONLY );
|
||||
}
|
||||
}
|
||||
|
||||
return NAV_OK;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
@@ -1429,19 +1393,39 @@ NavErrorType CNavMesh::Load( void )
|
||||
|
||||
CNavArea::m_nextID = 1;
|
||||
|
||||
// nav filename is derived from map filename
|
||||
char filename[256];
|
||||
Q_snprintf( filename, sizeof( filename ), FORMAT_NAVFILE, STRING( gpGlobals->mapname ) );
|
||||
|
||||
bool navIsInBsp = false;
|
||||
CUtlBuffer fileBuffer( 4096, 1024*1024, CUtlBuffer::READ_ONLY );
|
||||
NavErrorType readResult = GetNavDataFromFile( fileBuffer, &navIsInBsp );
|
||||
if ( readResult != NAV_OK )
|
||||
if ( !filesystem->ReadFile( filename, "MOD", fileBuffer ) ) // this ignores .nav files embedded in the .bsp ...
|
||||
{
|
||||
return readResult;
|
||||
navIsInBsp = true;
|
||||
if ( !filesystem->ReadFile( filename, "BSP", fileBuffer ) ) // ... and this looks for one if it's the only one around.
|
||||
{
|
||||
return NAV_CANT_ACCESS_FILE;
|
||||
}
|
||||
}
|
||||
|
||||
if ( IsX360() )
|
||||
{
|
||||
// 360 has compressed NAVs
|
||||
CLZMA lzma;
|
||||
if ( lzma.IsCompressed( (unsigned char *)fileBuffer.Base() ) )
|
||||
{
|
||||
int originalSize = lzma.GetActualSize( (unsigned char *)fileBuffer.Base() );
|
||||
unsigned char *pOriginalData = new unsigned char[originalSize];
|
||||
lzma.Uncompress( (unsigned char *)fileBuffer.Base(), pOriginalData );
|
||||
fileBuffer.AssumeMemory( pOriginalData, originalSize, originalSize, CUtlBuffer::READ_ONLY );
|
||||
}
|
||||
}
|
||||
|
||||
// check magic number
|
||||
unsigned int magic = fileBuffer.GetUnsignedInt();
|
||||
if ( !fileBuffer.IsValid() || magic != NAV_MAGIC_NUMBER )
|
||||
{
|
||||
Msg( "Invalid navigation file.\n" );
|
||||
Msg( "Invalid navigation file '%s'.\n", filename );
|
||||
return NAV_INVALID_FILE;
|
||||
}
|
||||
|
||||
@@ -1452,7 +1436,7 @@ NavErrorType CNavMesh::Load( void )
|
||||
Msg( "Unknown navigation file version.\n" );
|
||||
return NAV_BAD_FILE_VERSION;
|
||||
}
|
||||
|
||||
|
||||
unsigned int subVersion = 0;
|
||||
if ( version >= 10 )
|
||||
{
|
||||
@@ -1470,8 +1454,11 @@ NavErrorType CNavMesh::Load( void )
|
||||
unsigned int saveBspSize = fileBuffer.GetUnsignedInt();
|
||||
|
||||
// verify size
|
||||
char bspFilename[MAX_PATH] = { 0 };
|
||||
Q_snprintf( bspFilename, sizeof( bspFilename ), FORMAT_BSPFILE , STRING( gpGlobals->mapname ) );
|
||||
char *bspFilename = GetBspFilename( filename );
|
||||
if ( bspFilename == NULL )
|
||||
{
|
||||
return NAV_INVALID_FILE;
|
||||
}
|
||||
|
||||
unsigned int bspSize = filesystem->Size( bspFilename );
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@ ConVar nav_slope_tolerance( "nav_slope_tolerance", "0.1", FCVAR_CHEAT, "The grou
|
||||
ConVar nav_displacement_test( "nav_displacement_test", "10000", FCVAR_CHEAT, "Checks for nodes embedded in displacements (useful for in-development maps)" );
|
||||
ConVar nav_generate_fencetops( "nav_generate_fencetops", "1", FCVAR_CHEAT, "Autogenerate nav areas on fence and obstacle tops" );
|
||||
ConVar nav_generate_fixup_jump_areas( "nav_generate_fixup_jump_areas", "1", FCVAR_CHEAT, "Convert obsolete jump areas into 2-way connections" );
|
||||
ConVar nav_generate_jump_connections( "nav_generate_jump_connections", "1", FCVAR_CHEAT, "If disabled, don't generate jump connections from jump areas" );
|
||||
ConVar nav_generate_incremental_range( "nav_generate_incremental_range", "2000", FCVAR_CHEAT );
|
||||
ConVar nav_generate_incremental_tolerance( "nav_generate_incremental_tolerance", "0", FCVAR_CHEAT, "Z tolerance for adding new nav areas." );
|
||||
ConVar nav_area_max_size( "nav_area_max_size", "50", FCVAR_CHEAT, "Max area size created in nav generation" );
|
||||
@@ -498,11 +497,6 @@ class JumpConnector
|
||||
public:
|
||||
bool operator()( CNavArea *jumpArea )
|
||||
{
|
||||
if ( !nav_generate_jump_connections.GetBool() )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( !(jumpArea->GetAttributes() & NAV_MESH_JUMP) )
|
||||
{
|
||||
return true;
|
||||
@@ -1235,12 +1229,9 @@ void CNavMesh::RemoveOverlappingObstacleTopAreas()
|
||||
|
||||
static void CommandNavCheckStairs( void )
|
||||
{
|
||||
if ( !UTIL_IsCommandIssuedByServerAdmin() )
|
||||
return;
|
||||
|
||||
TheNavMesh->MarkStairAreas();
|
||||
}
|
||||
static ConCommand nav_check_stairs( "nav_check_stairs", CommandNavCheckStairs, "Update the nav mesh STAIRS attribute", FCVAR_CHEAT );
|
||||
static ConCommand nav_check_stairs( "nav_check_stairs", CommandNavCheckStairs, "Update the nav mesh STAIRS attribute" );
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
@@ -1454,9 +1445,6 @@ bool CNavArea::TestStairs( void )
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
CON_COMMAND_F( nav_test_stairs, "Test the selected set for being on stairs", FCVAR_CHEAT )
|
||||
{
|
||||
if ( !UTIL_IsCommandIssuedByServerAdmin() )
|
||||
return;
|
||||
|
||||
int count = 0;
|
||||
|
||||
const NavAreaVector &selectedSet = TheNavMesh->GetSelectedSet();
|
||||
@@ -1801,11 +1789,6 @@ inline bool testJumpDown( const Vector *fromPos, const Vector *toPos )
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
inline CNavArea *findJumpDownArea( const Vector *fromPos, NavDirType dir )
|
||||
{
|
||||
if ( !nav_generate_jump_connections.GetBool() )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Vector start( fromPos->x, fromPos->y, fromPos->z + HalfHumanHeight );
|
||||
AddDirectionVector( &start, dir, GenerationStepSize/2.0f );
|
||||
|
||||
@@ -1826,8 +1809,6 @@ void CNavMesh::StitchAreaIntoMesh( CNavArea *area, NavDirType dir, Functor &func
|
||||
Vector corner1, corner2;
|
||||
switch ( dir )
|
||||
{
|
||||
default:
|
||||
Assert(0);
|
||||
case NORTH:
|
||||
corner1 = area->GetCorner( NORTH_WEST );
|
||||
corner2 = area->GetCorner( NORTH_EAST );
|
||||
@@ -4949,8 +4930,5 @@ void CNavMesh::PostProcessCliffAreas()
|
||||
|
||||
CON_COMMAND_F( nav_gen_cliffs_approx, "Mark cliff areas, post-processing approximation", FCVAR_CHEAT )
|
||||
{
|
||||
if ( !UTIL_IsCommandIssuedByServerAdmin() )
|
||||
return;
|
||||
|
||||
TheNavMesh->PostProcessCliffAreas();
|
||||
}
|
||||
|
||||
@@ -49,9 +49,7 @@ ConVar nav_max_vis_delta_list_length( "nav_max_vis_delta_list_length", "64", FCV
|
||||
|
||||
extern ConVar nav_show_potentially_visible;
|
||||
|
||||
#ifdef STAGING_ONLY
|
||||
int g_DebugPathfindCounter = 0;
|
||||
#endif
|
||||
|
||||
|
||||
bool FindGroundForNode( Vector *pos, Vector *normal );
|
||||
@@ -1700,9 +1698,6 @@ static ConCommand nav_clear_selected_set( "nav_clear_selected_set", CommandNavCl
|
||||
//----------------------------------------------------------------------------------
|
||||
CON_COMMAND_F( nav_dump_selected_set_positions, "Write the (x,y,z) coordinates of the centers of all selected nav areas to a file.", FCVAR_GAMEDLL | FCVAR_CHEAT )
|
||||
{
|
||||
if ( !UTIL_IsCommandIssuedByServerAdmin() )
|
||||
return;
|
||||
|
||||
const NavAreaVector &selectedSet = TheNavMesh->GetSelectedSet();
|
||||
|
||||
CUtlBuffer fileBuffer( 4096, 1024*1024, CUtlBuffer::TEXT_BUFFER );
|
||||
@@ -1735,9 +1730,6 @@ CON_COMMAND_F( nav_dump_selected_set_positions, "Write the (x,y,z) coordinates o
|
||||
//----------------------------------------------------------------------------------
|
||||
CON_COMMAND_F( nav_show_dumped_positions, "Show the (x,y,z) coordinate positions of the given dump file.", FCVAR_GAMEDLL | FCVAR_CHEAT )
|
||||
{
|
||||
if ( !UTIL_IsCommandIssuedByServerAdmin() )
|
||||
return;
|
||||
|
||||
CUtlBuffer fileBuffer( 4096, 1024*1024, CUtlBuffer::TEXT_BUFFER );
|
||||
|
||||
// filename is local to game dir for Steam, so we need to prepend game dir for regular file save
|
||||
@@ -1770,9 +1762,6 @@ CON_COMMAND_F( nav_show_dumped_positions, "Show the (x,y,z) coordinate positions
|
||||
//----------------------------------------------------------------------------------
|
||||
CON_COMMAND_F( nav_select_larger_than, "Select nav areas where both dimensions are larger than the given size.", FCVAR_GAMEDLL | FCVAR_CHEAT )
|
||||
{
|
||||
if ( !UTIL_IsCommandIssuedByServerAdmin() )
|
||||
return;
|
||||
|
||||
if ( args.ArgC() > 1 )
|
||||
{
|
||||
float minSize = atof( args[1] );
|
||||
@@ -2674,9 +2663,6 @@ void CNavMesh::CommandNavMarkWalkable( void )
|
||||
{
|
||||
Vector pos;
|
||||
|
||||
if ( !UTIL_IsCommandIssuedByServerAdmin() )
|
||||
return;
|
||||
|
||||
if (nav_edit.GetBool())
|
||||
{
|
||||
// we are in edit mode, use the edit cursor's location
|
||||
|
||||
@@ -73,7 +73,6 @@ public:
|
||||
bool operator()( CBaseCombatCharacter *actor )
|
||||
{
|
||||
actor->OnNavAreaRemoved( m_deadArea );
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -198,9 +197,15 @@ public:
|
||||
|
||||
unsigned int operator()( const NavVisPair_t &item ) const
|
||||
{
|
||||
#if PLATFORM_64BITS
|
||||
COMPILE_TIME_ASSERT( sizeof(CNavArea *) == 8 );
|
||||
int64 key[2] = { (int64)(item.pAreas[0] + item.pAreas[1]->GetID()), (int64)(item.pAreas[1] + item.pAreas[0]->GetID()) };
|
||||
return Hash16( key );
|
||||
#else
|
||||
COMPILE_TIME_ASSERT( sizeof(CNavArea *) == 4 );
|
||||
int key[2] = { (int)item.pAreas[0] + (int)item.pAreas[1]->GetID(), (int)item.pAreas[1] + (int)item.pAreas[0]->GetID() };
|
||||
int key[2] = { (int)(item.pAreas[0] + item.pAreas[1]->GetID()), (int)(item.pAreas[1] + item.pAreas[0]->GetID()) };
|
||||
return Hash8( key );
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1052,8 +1057,6 @@ public:
|
||||
void SimplifySelectedAreas( void ); // Simplifies the selected set by reducing to 1x1 areas and re-merging them up with loosened tolerances
|
||||
|
||||
protected:
|
||||
NavErrorType GetNavDataFromFile( CUtlBuffer &outBuffer, bool *pNavDataFromBSP = NULL );
|
||||
|
||||
virtual void PostCustomAnalysis( void ) { } // invoked when custom analysis step is complete
|
||||
bool FindActiveNavArea( void ); // Finds the area or ladder the local player is currently pointing at. Returns true if a surface was hit by the traceline.
|
||||
virtual void RemoveNavArea( CNavArea *area ); // remove an area from the grid
|
||||
@@ -1261,10 +1264,8 @@ extern CNavMesh *TheNavMesh;
|
||||
// factory for creating the Navigation Mesh
|
||||
extern CNavMesh *NavMeshFactory( void );
|
||||
|
||||
#ifdef STAGING_ONLY
|
||||
// for debugging the A* algorithm, if nonzero, show debug display and decrement for each pathfind
|
||||
extern int g_DebugPathfindCounter;
|
||||
#endif
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -16,9 +16,7 @@
|
||||
#include "mathlib/ssemath.h"
|
||||
#include "nav_area.h"
|
||||
|
||||
#ifdef STAGING_ONLY
|
||||
extern int g_DebugPathfindCounter;
|
||||
#endif
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
@@ -110,9 +108,7 @@ bool NavAreaBuildPath( CNavArea *startArea, CNavArea *goalArea, const Vector *go
|
||||
*closestArea = startArea;
|
||||
}
|
||||
|
||||
#ifdef STAGING_ONLY
|
||||
bool isDebug = ( g_DebugPathfindCounter-- > 0 );
|
||||
#endif
|
||||
|
||||
if (startArea == NULL)
|
||||
return false;
|
||||
@@ -158,12 +154,10 @@ bool NavAreaBuildPath( CNavArea *startArea, CNavArea *goalArea, const Vector *go
|
||||
// get next area to check
|
||||
CNavArea *area = CNavArea::PopOpenList();
|
||||
|
||||
#ifdef STAGING_ONLY
|
||||
if ( isDebug )
|
||||
{
|
||||
area->DrawFilled( 0, 255, 0, 128, 30.0f );
|
||||
}
|
||||
#endif
|
||||
|
||||
// don't consider blocked areas
|
||||
if ( area->IsBlocked( teamID, ignoreNavBlockers ) )
|
||||
@@ -345,13 +339,7 @@ bool NavAreaBuildPath( CNavArea *startArea, CNavArea *goalArea, const Vector *go
|
||||
continue;
|
||||
|
||||
float newCostSoFar = costFunc( newArea, area, ladder, elevator, length );
|
||||
|
||||
// NaNs really mess this function up causing tough to track down hangs. If
|
||||
// we get inf back, clamp it down to a really high number.
|
||||
DebuggerBreakOnNaN_StagingOnly( newCostSoFar );
|
||||
if ( IS_NAN( newCostSoFar ) )
|
||||
newCostSoFar = 1e30f;
|
||||
|
||||
|
||||
// check if cost functor says this area is a dead-end
|
||||
if ( newCostSoFar < 0.0f )
|
||||
continue;
|
||||
@@ -364,7 +352,7 @@ bool NavAreaBuildPath( CNavArea *startArea, CNavArea *goalArea, const Vector *go
|
||||
// Make sure that any jump to a new area incurs some pathfinsing
|
||||
// cost, to avoid us spinning our wheels over insignificant cost
|
||||
// benefit, floating point precision bug, or busted cost functor.
|
||||
float minNewCostSoFar = area->GetCostSoFar() * 1.00001f + 0.00001f;
|
||||
float minNewCostSoFar = area->GetCostSoFar() * 1.00001 + 0.00001;
|
||||
newCostSoFar = Max( newCostSoFar, minNewCostSoFar );
|
||||
|
||||
// stop if path length limit reached
|
||||
|
||||
@@ -24,11 +24,11 @@ class CStringTableSaveRestoreOps;
|
||||
#define MAX_MATERIAL_STRINGS ( 1 << MAX_MATERIAL_STRING_BITS )
|
||||
#define OVERLAY_MATERIAL_INVALID_STRING ( MAX_MATERIAL_STRINGS - 1 )
|
||||
|
||||
#define MAX_CHOREO_SCENES_STRING_BITS 13
|
||||
#define MAX_CHOREO_SCENES_STRING_BITS 12
|
||||
#define MAX_CHOREO_SCENES_STRINGS ( 1 << MAX_CHOREO_SCENES_STRING_BITS )
|
||||
#define CHOREO_SCENES_INVALID_STRING ( MAX_CHOREO_SCENES_STRINGS - 1 )
|
||||
|
||||
#define MAX_PARTICLESYSTEMS_STRING_BITS 12
|
||||
#define MAX_PARTICLESYSTEMS_STRING_BITS 11
|
||||
#define MAX_PARTICLESYSTEMS_STRINGS ( 1 << MAX_PARTICLESYSTEMS_STRING_BITS )
|
||||
#define PARTICLESYSTEMS_INVALID_STRING ( MAX_PARTICLESYSTEMS_STRINGS - 1 )
|
||||
|
||||
|
||||
+9
-29
@@ -74,7 +74,7 @@ static float g_PhysAverageSimTime;
|
||||
CCallQueue g_PostSimulationQueue;
|
||||
|
||||
|
||||
// local roeutines
|
||||
// local routines
|
||||
static IPhysicsObject *PhysCreateWorld( CBaseEntity *pWorld );
|
||||
static void PhysFrame( float deltaTime );
|
||||
static bool IsDebris( int collisionGroup );
|
||||
@@ -243,7 +243,7 @@ void CPhysicsHook::LevelInitPreEntity()
|
||||
|
||||
physenv->SetObjectEventHandler( &g_Collisions );
|
||||
|
||||
physenv->SetSimulationTimestep( gpGlobals->interval_per_tick ); // 15 ms per tick
|
||||
physenv->SetSimulationTimestep( DEFAULT_TICK_INTERVAL ); // 15 ms per tick
|
||||
// HL Game gravity, not real-world gravity
|
||||
physenv->SetGravity( Vector( 0, 0, -GetCurrentGravity() ) );
|
||||
g_PhysAverageSimTime = 0;
|
||||
@@ -1068,7 +1068,7 @@ void CCollisionEvent::FluidStartTouch( IPhysicsObject *pObject, IPhysicsFluidCon
|
||||
return;
|
||||
|
||||
pEntity->AddEFlags( EFL_TOUCHING_FLUID );
|
||||
pEntity->OnEntityEvent( ENTITY_EVENT_WATER_TOUCH, (void*)pFluid->GetContents() );
|
||||
pEntity->OnEntityEvent( ENTITY_EVENT_WATER_TOUCH, (void*)(intp)pFluid->GetContents() );
|
||||
|
||||
float timeSinceLastCollision = DeltaTimeSinceLastFluid( pEntity );
|
||||
if ( timeSinceLastCollision < 0.5f )
|
||||
@@ -1124,7 +1124,7 @@ void CCollisionEvent::FluidEndTouch( IPhysicsObject *pObject, IPhysicsFluidContr
|
||||
}
|
||||
|
||||
pEntity->RemoveEFlags( EFL_TOUCHING_FLUID );
|
||||
pEntity->OnEntityEvent( ENTITY_EVENT_WATER_UNTOUCH, (void*)pFluid->GetContents() );
|
||||
pEntity->OnEntityEvent( ENTITY_EVENT_WATER_UNTOUCH, (void*)(intp)pFluid->GetContents() );
|
||||
}
|
||||
|
||||
class CSkipKeys : public IVPhysicsKeyHandler
|
||||
@@ -1606,7 +1606,7 @@ CON_COMMAND( physics_budget, "Times the cost of each active object" )
|
||||
float totalTime = 0.f;
|
||||
g_Collisions.BufferTouchEvents( true );
|
||||
float full = engine->Time();
|
||||
physenv->Simulate( gpGlobals->interval_per_tick );
|
||||
physenv->Simulate( DEFAULT_TICK_INTERVAL );
|
||||
full = engine->Time() - full;
|
||||
float lastTime = full;
|
||||
|
||||
@@ -1623,7 +1623,7 @@ CON_COMMAND( physics_budget, "Times the cost of each active object" )
|
||||
PhysForceEntityToSleep( ents[j], ents[j]->VPhysicsGetObject() );
|
||||
}
|
||||
float start = engine->Time();
|
||||
physenv->Simulate( gpGlobals->interval_per_tick );
|
||||
physenv->Simulate( DEFAULT_TICK_INTERVAL );
|
||||
float end = engine->Time();
|
||||
|
||||
float elapsed = end - start;
|
||||
@@ -1689,7 +1689,6 @@ void PhysFrame( float deltaTime )
|
||||
float simRealTime = 0;
|
||||
|
||||
deltaTime *= phys_timescale.GetFloat();
|
||||
|
||||
// !!!HACKHACK -- hard limit scaled time to avoid spending too much time in here
|
||||
// Limit to 100 ms
|
||||
if ( deltaTime > 0.100f )
|
||||
@@ -1710,28 +1709,10 @@ void PhysFrame( float deltaTime )
|
||||
g_Collisions.BufferTouchEvents( true );
|
||||
#endif
|
||||
|
||||
int activeCount = physenv->GetActiveObjectCount();
|
||||
IPhysicsObject **pActiveList = NULL;
|
||||
#if 0
|
||||
if ( activeCount )
|
||||
{
|
||||
pActiveList = (IPhysicsObject **)stackalloc( sizeof(IPhysicsObject *)*activeCount );
|
||||
physenv->GetActiveObjects( pActiveList );
|
||||
|
||||
for ( int i = 0; i < activeCount; i++ )
|
||||
{
|
||||
CBaseEntity *pEntity = reinterpret_cast<CBaseEntity *>(pActiveList[i]->GetGameData());
|
||||
OutputVPhysicsDebugInfo(pEntity);
|
||||
}
|
||||
stackfree( pActiveList );
|
||||
}
|
||||
#endif
|
||||
|
||||
physenv->Simulate( deltaTime );
|
||||
|
||||
activeCount = physenv->GetActiveObjectCount();
|
||||
pActiveList = NULL;
|
||||
|
||||
int activeCount = physenv->GetActiveObjectCount();
|
||||
IPhysicsObject **pActiveList = NULL;
|
||||
if ( activeCount )
|
||||
{
|
||||
pActiveList = (IPhysicsObject **)stackalloc( sizeof(IPhysicsObject *)*activeCount );
|
||||
@@ -1740,7 +1721,6 @@ void PhysFrame( float deltaTime )
|
||||
for ( int i = 0; i < activeCount; i++ )
|
||||
{
|
||||
CBaseEntity *pEntity = reinterpret_cast<CBaseEntity *>(pActiveList[i]->GetGameData());
|
||||
// OutputVPhysicsDebugInfo(pEntity);
|
||||
if ( pEntity )
|
||||
{
|
||||
if ( pEntity->CollisionProp()->DoesVPhysicsInvalidateSurroundingBox() )
|
||||
@@ -1968,7 +1948,7 @@ void CCollisionEvent::Friction( IPhysicsObject *pObject, float energy, int surfa
|
||||
if ( pEntity )
|
||||
{
|
||||
friction_t *pFriction = g_Collisions.FindFriction( pEntity );
|
||||
|
||||
|
||||
if ( pFriction && pFriction->pObject)
|
||||
{
|
||||
// in MP mode play sound and effects once every 500 msecs,
|
||||
|
||||
@@ -126,7 +126,7 @@ void CPhysicsPushedEntities::UnlinkPusherList( int *pPusherHandles )
|
||||
{
|
||||
for ( int i = m_rgPusher.Count(); --i >= 0; )
|
||||
{
|
||||
pPusherHandles[i] = ::partition->HideElement( m_rgPusher[i].m_pEntity->CollisionProp()->GetPartitionHandle() );
|
||||
pPusherHandles[i] = partition->HideElement( m_rgPusher[i].m_pEntity->CollisionProp()->GetPartitionHandle() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ void CPhysicsPushedEntities::RelinkPusherList( int *pPusherHandles )
|
||||
{
|
||||
for ( int i = m_rgPusher.Count(); --i >= 0; )
|
||||
{
|
||||
::partition->UnhideElement( m_rgPusher[i].m_pEntity->CollisionProp()->GetPartitionHandle(), pPusherHandles[i] );
|
||||
partition->UnhideElement( m_rgPusher[i].m_pEntity->CollisionProp()->GetPartitionHandle(), pPusherHandles[i] );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -696,7 +696,7 @@ void CPhysicsPushedEntities::GenerateBlockingEntityList()
|
||||
|
||||
Vector vecAbsMins, vecAbsMaxs;
|
||||
pPusher->CollisionProp()->WorldSpaceAABB( &vecAbsMins, &vecAbsMaxs );
|
||||
::partition->EnumerateElementsInBox( PARTITION_ENGINE_NON_STATIC_EDICTS, vecAbsMins, vecAbsMaxs, false, &blockerEnum );
|
||||
partition->EnumerateElementsInBox( PARTITION_ENGINE_NON_STATIC_EDICTS, vecAbsMins, vecAbsMaxs, false, &blockerEnum );
|
||||
|
||||
//Go back throught the generated list.
|
||||
}
|
||||
@@ -736,15 +736,13 @@ void CPhysicsPushedEntities::GenerateBlockingEntityListAddBox( const Vector &vec
|
||||
}
|
||||
}
|
||||
|
||||
::partition->EnumerateElementsInBox( PARTITION_ENGINE_NON_STATIC_EDICTS, vecAbsMins, vecAbsMaxs, false, &blockerEnum );
|
||||
partition->EnumerateElementsInBox( PARTITION_ENGINE_NON_STATIC_EDICTS, vecAbsMins, vecAbsMaxs, false, &blockerEnum );
|
||||
|
||||
//Go back throught the generated list.
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef TF_DLL
|
||||
#include "tf_logic_robot_destruction.h"
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Gets a list of all entities hierarchically attached to the root
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -1843,9 +1841,7 @@ void CBaseEntity::PhysicsStepRunTimestep( float timestep )
|
||||
{
|
||||
bool wasonground;
|
||||
bool inwater;
|
||||
#if 0
|
||||
bool hitsound = false;
|
||||
#endif
|
||||
float speed, newspeed, control;
|
||||
float friction;
|
||||
|
||||
@@ -1866,12 +1862,10 @@ void CBaseEntity::PhysicsStepRunTimestep( float timestep )
|
||||
{
|
||||
if ( !( ( GetFlags() & FL_SWIM ) && ( GetWaterLevel() > 0 ) ) )
|
||||
{
|
||||
#if 0
|
||||
if ( GetAbsVelocity()[2] < ( GetCurrentGravity() * -0.1 ) )
|
||||
{
|
||||
hitsound = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( !inwater )
|
||||
{
|
||||
|
||||
+50
-71
@@ -183,7 +183,7 @@ ConVar sk_player_stomach( "sk_player_stomach","1" );
|
||||
ConVar sk_player_arm( "sk_player_arm","1" );
|
||||
ConVar sk_player_leg( "sk_player_leg","1" );
|
||||
|
||||
ConVar sv_player_usercommand_timeout( "sv_player_usercommand_timeout", "3", FCVAR_CHEAT, "After this many seconds without a usercommand from a player, the server will RunNullCommand as if client sends an empty command." );
|
||||
//ConVar player_usercommand_timeout( "player_usercommand_timeout", "10", 0, "After this many seconds without a usercommand from a player, the client is kicked." );
|
||||
#ifdef _DEBUG
|
||||
ConVar sv_player_net_suppress_usercommands( "sv_player_net_suppress_usercommands", "0", FCVAR_CHEAT, "For testing usercommand hacking sideeffects. DO NOT SHIP" );
|
||||
#endif // _DEBUG
|
||||
@@ -585,9 +585,7 @@ CBasePlayer::CBasePlayer( )
|
||||
m_bForceOrigin = false;
|
||||
m_hVehicle = NULL;
|
||||
m_pCurrentCommand = NULL;
|
||||
m_iLockViewanglesTickNumber = 0;
|
||||
m_qangLockViewangles.Init();
|
||||
|
||||
|
||||
// Setup our default FOV
|
||||
m_iDefaultFOV = g_pGameRules->DefaultFOV();
|
||||
|
||||
@@ -637,8 +635,6 @@ CBasePlayer::CBasePlayer( )
|
||||
|
||||
m_flLastUserCommandTime = 0.f;
|
||||
m_flMovementTimeForUserCmdProcessingRemaining = 0.0f;
|
||||
|
||||
m_flLastObjectiveTime = -1.f;
|
||||
}
|
||||
|
||||
CBasePlayer::~CBasePlayer( )
|
||||
@@ -978,7 +974,7 @@ void CBasePlayer::DamageEffect(float flDamage, int fDamageType)
|
||||
}
|
||||
else if (fDamageType & DMG_DROWN)
|
||||
{
|
||||
//Blue damage indicator
|
||||
//Red damage indicator
|
||||
color32 blue = {0,0,128,128};
|
||||
UTIL_ScreenFade( this, blue, 1.0f, 0.1f, FFADE_IN );
|
||||
}
|
||||
@@ -2327,7 +2323,6 @@ bool CBasePlayer::SetObserverMode(int mode )
|
||||
break;
|
||||
|
||||
case OBS_MODE_CHASE :
|
||||
case OBS_MODE_POI: // PASSTIME
|
||||
case OBS_MODE_IN_EYE :
|
||||
// udpate FOV and viewmodels
|
||||
SetObserverTarget( m_hObserverTarget );
|
||||
@@ -2423,7 +2418,8 @@ void CBasePlayer::CheckObserverSettings()
|
||||
}
|
||||
|
||||
// check if our spectating target is still a valid one
|
||||
if ( m_iObserverMode == OBS_MODE_IN_EYE || m_iObserverMode == OBS_MODE_CHASE || m_iObserverMode == OBS_MODE_FIXED || m_iObserverMode == OBS_MODE_POI )
|
||||
|
||||
if ( m_iObserverMode == OBS_MODE_IN_EYE || m_iObserverMode == OBS_MODE_CHASE || m_iObserverMode == OBS_MODE_FIXED )
|
||||
{
|
||||
ValidateCurrentObserverTarget();
|
||||
|
||||
@@ -2477,7 +2473,6 @@ void CBasePlayer::ValidateCurrentObserverTarget( void )
|
||||
}
|
||||
else
|
||||
{
|
||||
#if !defined( TF_DLL )
|
||||
// couldn't find new target, switch to temporary mode
|
||||
if ( mp_forcecamera.GetInt() == OBS_ALLOW_ALL )
|
||||
{
|
||||
@@ -2485,11 +2480,10 @@ void CBasePlayer::ValidateCurrentObserverTarget( void )
|
||||
ForceObserverMode( OBS_MODE_ROAMING );
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
// fix player view right where it is
|
||||
ForceObserverMode( OBS_MODE_FIXED );
|
||||
m_hObserverTarget.Set( NULL ); // no target to follow
|
||||
m_hObserverTarget.Set( NULL ); // no traget to follow
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2635,10 +2629,7 @@ bool CBasePlayer::SetObserverTarget(CBaseEntity *target)
|
||||
Vector dir, end;
|
||||
Vector start = target->EyePosition();
|
||||
|
||||
QAngle ang = target->EyeAngles();
|
||||
ang.z = 0; // PASSTIME no view roll when spectating ball
|
||||
|
||||
AngleVectors( ang, &dir );
|
||||
AngleVectors( target->EyeAngles(), &dir );
|
||||
VectorNormalize( dir );
|
||||
VectorMA( start, -64.0f, dir, end );
|
||||
|
||||
@@ -2648,7 +2639,7 @@ bool CBasePlayer::SetObserverTarget(CBaseEntity *target)
|
||||
trace_t tr;
|
||||
UTIL_TraceRay( ray, MASK_PLAYERSOLID, target, COLLISION_GROUP_PLAYER_MOVEMENT, &tr );
|
||||
|
||||
JumptoPosition( tr.endpos, ang );
|
||||
JumptoPosition( tr.endpos, target->EyeAngles() );
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -3380,20 +3371,27 @@ void CBasePlayer::PhysicsSimulate( void )
|
||||
pi->m_nNumCmds = commandsToRun;
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
else if ( GetTimeSinceLastUserCommand() > sv_player_usercommand_timeout.GetFloat() )
|
||||
{
|
||||
// no usercommand from player after some threshold
|
||||
// server should start RunNullCommand as if client sends an empty command so that Think and gamestate related things run properly
|
||||
RunNullCommand();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Restore the true server clock
|
||||
// FIXME: Should this occur after simulation of children so
|
||||
// that they are in the timespace of the player?
|
||||
gpGlobals->curtime = savetime;
|
||||
gpGlobals->frametime = saveframetime;
|
||||
gpGlobals->frametime = saveframetime;
|
||||
|
||||
// // Kick the player if they haven't sent a user command in awhile in order to prevent clients
|
||||
// // from using packet-level manipulation to mess with gamestate. Not sending usercommands seems
|
||||
// // to have all kinds of bad effects, such as stalling a bunch of Think()'s and gamestate handling.
|
||||
// // An example from TF: A medic stops sending commands after deploying an uber on another player.
|
||||
// // As a result, invuln is permanently on the heal target because the maintenance code is stalled.
|
||||
// if ( GetTimeSinceLastUserCommand() > player_usercommand_timeout.GetFloat() )
|
||||
// {
|
||||
// // If they have an active netchan, they're almost certainly messing with usercommands?
|
||||
// INetChannelInfo *pNetChanInfo = engine->GetPlayerNetInfo( entindex() );
|
||||
// if ( pNetChanInfo && pNetChanInfo->GetTimeSinceLastReceived() < 5.f )
|
||||
// {
|
||||
// engine->ServerCommand( UTIL_VarArgs( "kickid %d %s\n", GetUserID(), "UserCommand Timeout" ) );
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
unsigned int CBasePlayer::PhysicsSolidMaskForEntity() const
|
||||
@@ -3409,8 +3407,6 @@ void CBasePlayer::ForceSimulation()
|
||||
m_nSimulationTick = -1;
|
||||
}
|
||||
|
||||
ConVar sv_usercmd_custom_random_seed( "sv_usercmd_custom_random_seed", "1", FCVAR_CHEAT, "When enabled server will populate an additional random seed independent of the client" );
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Input : *buf -
|
||||
@@ -3437,16 +3433,6 @@ void CBasePlayer::ProcessUsercmds( CUserCmd *cmds, int numcmds, int totalcmds,
|
||||
pCmd->MakeInert();
|
||||
}
|
||||
|
||||
if ( sv_usercmd_custom_random_seed.GetBool() )
|
||||
{
|
||||
float fltTimeNow = float( Plat_FloatTime() * 1000.0 );
|
||||
pCmd->server_random_seed = *reinterpret_cast<int*>( (char*)&fltTimeNow );
|
||||
}
|
||||
else
|
||||
{
|
||||
pCmd->server_random_seed = pCmd->random_seed;
|
||||
}
|
||||
|
||||
ctx->cmds.AddToTail( *pCmd );
|
||||
}
|
||||
ctx->numcmds = numcmds;
|
||||
@@ -6441,7 +6427,7 @@ bool CBasePlayer::ClientCommand( const CCommand &args )
|
||||
{
|
||||
// set new spectator mode, don't allow OBS_MODE_NONE
|
||||
if ( !SetObserverMode( mode ) )
|
||||
ClientPrint( this, HUD_PRINTCONSOLE, "#Spectator_Mode_Unknown");
|
||||
ClientPrint( this, HUD_PRINTCONSOLE, "#Spectator_Mode_Unkown");
|
||||
else
|
||||
engine->ClientCommand( edict(), "cl_spec_mode %d", mode );
|
||||
}
|
||||
@@ -6472,7 +6458,7 @@ bool CBasePlayer::ClientCommand( const CCommand &args )
|
||||
|
||||
return true;
|
||||
}
|
||||
else if ( stricmp( cmd, "spec_prev" ) == 0 ) // chase previous player
|
||||
else if ( stricmp( cmd, "spec_prev" ) == 0 ) // chase prevoius player
|
||||
{
|
||||
if ( GetObserverMode() > OBS_MODE_FIXED )
|
||||
{
|
||||
@@ -6487,21 +6473,33 @@ bool CBasePlayer::ClientCommand( const CCommand &args )
|
||||
{
|
||||
AttemptToExitFreezeCam();
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
else if ( stricmp( cmd, "spec_player" ) == 0 ) // chase next player
|
||||
{
|
||||
if ( GetObserverMode() > OBS_MODE_FIXED && args.ArgC() == 2 )
|
||||
{
|
||||
CBasePlayer *target = UTIL_PlayerByCommandArg( args[1] );
|
||||
int index = atoi( args[1] );
|
||||
|
||||
CBasePlayer * target;
|
||||
|
||||
if ( index == 0 )
|
||||
{
|
||||
target = UTIL_PlayerByName( args[1] );
|
||||
}
|
||||
else
|
||||
{
|
||||
target = UTIL_PlayerByIndex( index );
|
||||
}
|
||||
|
||||
if ( IsValidObserverTarget( target ) )
|
||||
{
|
||||
SetObserverTarget( target );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -6512,9 +6510,9 @@ bool CBasePlayer::ClientCommand( const CCommand &args )
|
||||
args.ArgC() == 6 )
|
||||
{
|
||||
Vector origin;
|
||||
origin.x = clamp( atof( args[1] ), MIN_COORD_FLOAT, MAX_COORD_FLOAT );
|
||||
origin.y = clamp( atof( args[2] ), MIN_COORD_FLOAT, MAX_COORD_FLOAT );
|
||||
origin.z = clamp( atof( args[3] ), MIN_COORD_FLOAT, MAX_COORD_FLOAT );
|
||||
origin.x = atof( args[1] );
|
||||
origin.y = atof( args[2] );
|
||||
origin.z = atof( args[3] );
|
||||
|
||||
QAngle angle;
|
||||
angle.x = atof( args[4] );
|
||||
@@ -7381,7 +7379,7 @@ void CBasePlayer::EquipWearable( CEconWearable *pItem )
|
||||
pItem->Equip( this );
|
||||
}
|
||||
|
||||
#ifdef DBGFLAG_ASSERT
|
||||
#ifdef DEBUG
|
||||
// Double check list integrity.
|
||||
for ( int i = m_hMyWearables.Count()-1; i >= 0; --i )
|
||||
{
|
||||
@@ -7420,7 +7418,7 @@ void CBasePlayer::RemoveWearable( CEconWearable *pItem )
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DBGFLAG_ASSERT
|
||||
#ifdef DEBUG
|
||||
// Double check list integrity.
|
||||
for ( int i = m_hMyWearables.Count()-1; i >= 0; --i )
|
||||
{
|
||||
@@ -7452,7 +7450,7 @@ void CBasePlayer::PlayWearableAnimsForPlaybackEvent( wearableanimplayback_t iPla
|
||||
// Purpose: Put the player in the specified team
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void CBasePlayer::ChangeTeam( int iTeamNum, bool bAutoTeam, bool bSilent, bool bAutoBalance /*= false*/ )
|
||||
void CBasePlayer::ChangeTeam( int iTeamNum, bool bAutoTeam, bool bSilent)
|
||||
{
|
||||
if ( !GetGlobalTeam( iTeamNum ) )
|
||||
{
|
||||
@@ -7873,7 +7871,7 @@ void CMovementSpeedMod::InputSpeedMod(inputdata_t &data)
|
||||
// Bring the weapon back
|
||||
if ( HasSpawnFlags( SF_SPEED_MOD_SUPPRESS_WEAPONS ) && pPlayer->GetActiveWeapon() == NULL )
|
||||
{
|
||||
pPlayer->SetActiveWeapon( pPlayer->GetLastWeapon() );
|
||||
pPlayer->SetActiveWeapon( pPlayer->Weapon_GetLast() );
|
||||
if ( pPlayer->GetActiveWeapon() )
|
||||
{
|
||||
pPlayer->GetActiveWeapon()->Deploy();
|
||||
@@ -8949,27 +8947,8 @@ void CBasePlayer::HandleAnimEvent( animevent_t *pEvent )
|
||||
BaseClass::HandleAnimEvent( pEvent );
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CBasePlayer::ShouldAnnounceAchievement( void )
|
||||
{
|
||||
m_flAchievementTimes.AddToTail( gpGlobals->curtime );
|
||||
if ( m_flAchievementTimes.Count() > 3 )
|
||||
{
|
||||
m_flAchievementTimes.Remove( 0 );
|
||||
if ( m_flAchievementTimes.Tail() - m_flAchievementTimes.Head() <= 60.0 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CPlayerInfo functions (simple pass-through to get around the CBasePlayer multiple inheritance limitation)
|
||||
// CPlayerInfo functions (simple passthroughts to get around the CBasePlayer multiple inheritence limitation)
|
||||
//-----------------------------------------------------------------------------
|
||||
const char *CPlayerInfo::GetName()
|
||||
{
|
||||
@@ -9382,4 +9361,4 @@ uint64 CBasePlayer::GetSteamIDAsUInt64( void )
|
||||
return steamIDForPlayer.ConvertToUint64();
|
||||
return 0;
|
||||
}
|
||||
#endif // NO_STEAM
|
||||
#endif // NO_STEAM
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user