mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-29 21:49:20 +00:00
upload "kind" alien swarm
This commit is contained in:
+74
-24
@@ -1,9 +1,7 @@
|
||||
//========= Copyright Valve Corporation, All rights reserved. ============//
|
||||
//======= Copyright (c) 1996-2009, Valve Corporation, All rights reserved. ======
|
||||
//
|
||||
// Purpose:
|
||||
//
|
||||
// $NoKeywords: $
|
||||
//=============================================================================//
|
||||
//===============================================================================
|
||||
|
||||
#include "cbase.h"
|
||||
#include "rope.h"
|
||||
@@ -12,6 +10,7 @@
|
||||
#include "sendproxy.h"
|
||||
#include "rope_helpers.h"
|
||||
#include "te_effect_dispatch.h"
|
||||
#include "videocfg/videocfg.h"
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
@@ -37,6 +36,7 @@ IMPLEMENT_SERVERCLASS_ST_NOBASE( CRopeKeyframe, DT_RopeKeyframe )
|
||||
SendPropInt( SENDINFO(m_Slack), 12 ),
|
||||
SendPropInt( SENDINFO(m_RopeLength), 15 ),
|
||||
SendPropInt( SENDINFO(m_fLockedPoints), 4, SPROP_UNSIGNED ),
|
||||
SendPropInt( SENDINFO(m_nChangeCount), 8, SPROP_UNSIGNED ),
|
||||
SendPropInt( SENDINFO(m_RopeFlags), ROPE_NUMFLAGS, SPROP_UNSIGNED ),
|
||||
SendPropInt( SENDINFO(m_nSegments), 4, SPROP_UNSIGNED ),
|
||||
SendPropBool( SENDINFO(m_bConstrainBetweenEndpoints) ),
|
||||
@@ -51,6 +51,14 @@ IMPLEMENT_SERVERCLASS_ST_NOBASE( CRopeKeyframe, DT_RopeKeyframe )
|
||||
SendPropEHandle(SENDINFO_NAME(m_hMoveParent, moveparent) ),
|
||||
|
||||
SendPropInt (SENDINFO(m_iParentAttachment), NUM_PARENTATTACHMENT_BITS, SPROP_UNSIGNED),
|
||||
|
||||
#if 1
|
||||
// #ifndef _X360 -- X360 client and Win32 XLSP dedicated server need equivalent SendTables
|
||||
SendPropInt( SENDINFO(m_nMinCPULevel), CPU_LEVEL_BIT_COUNT, SPROP_UNSIGNED ),
|
||||
SendPropInt( SENDINFO(m_nMaxCPULevel), CPU_LEVEL_BIT_COUNT, SPROP_UNSIGNED ),
|
||||
SendPropInt( SENDINFO(m_nMinGPULevel), GPU_LEVEL_BIT_COUNT, SPROP_UNSIGNED ),
|
||||
SendPropInt( SENDINFO(m_nMaxGPULevel), GPU_LEVEL_BIT_COUNT, SPROP_UNSIGNED ),
|
||||
#endif
|
||||
END_SEND_TABLE()
|
||||
|
||||
|
||||
@@ -201,10 +209,11 @@ CRopeKeyframe* CRopeKeyframe::Create(
|
||||
int iEndAttachment,
|
||||
int ropeWidth,
|
||||
const char *pMaterialName,
|
||||
int numSegments
|
||||
int numSegments,
|
||||
const char *pClassName
|
||||
)
|
||||
{
|
||||
CRopeKeyframe *pRet = (CRopeKeyframe*)CreateEntityByName( "keyframe_rope" );
|
||||
CRopeKeyframe *pRet = (CRopeKeyframe*)CreateEntityByName( pClassName );
|
||||
if( !pRet )
|
||||
return NULL;
|
||||
|
||||
@@ -218,6 +227,7 @@ CRopeKeyframe* CRopeKeyframe::Create(
|
||||
pRet->SetMaterial( pMaterialName );
|
||||
pRet->m_Width = ropeWidth;
|
||||
pRet->m_nSegments = clamp( numSegments, 2, ROPE_MAX_SEGMENTS );
|
||||
pRet->Spawn();
|
||||
|
||||
return pRet;
|
||||
}
|
||||
@@ -230,10 +240,11 @@ CRopeKeyframe* CRopeKeyframe::CreateWithSecondPointDetached(
|
||||
int ropeWidth,
|
||||
const char *pMaterialName,
|
||||
int numSegments,
|
||||
bool bInitialHang
|
||||
bool bInitialHang,
|
||||
const char *pClassName
|
||||
)
|
||||
{
|
||||
CRopeKeyframe *pRet = (CRopeKeyframe*)CreateEntityByName( "keyframe_rope" );
|
||||
CRopeKeyframe *pRet = (CRopeKeyframe*)CreateEntityByName( pClassName );
|
||||
if( !pRet )
|
||||
return NULL;
|
||||
|
||||
@@ -283,6 +294,11 @@ void CRopeKeyframe::ActivateEndDirectionConstraints( bool bEnable )
|
||||
}
|
||||
|
||||
|
||||
void CRopeKeyframe::PrecacheShakeRopes()
|
||||
{
|
||||
PrecacheEffect( "ShakeRopes" );
|
||||
}
|
||||
|
||||
void CRopeKeyframe::ShakeRopes( const Vector &vCenter, float flRadius, float flMagnitude )
|
||||
{
|
||||
CEffectData shakeData;
|
||||
@@ -323,12 +339,30 @@ void CRopeKeyframe::Init()
|
||||
SetLocalAngles( vec3_angle );
|
||||
RecalculateLength();
|
||||
|
||||
m_nSegments = clamp( (int) m_nSegments, 2, ROPE_MAX_SEGMENTS );
|
||||
m_nSegments = clamp( m_nSegments, 2, ROPE_MAX_SEGMENTS );
|
||||
|
||||
UpdateBBox( true );
|
||||
|
||||
m_bStartPointValid = (m_hStartPoint.Get() != NULL);
|
||||
m_bEndPointValid = (m_hEndPoint.Get() != NULL);
|
||||
|
||||
// Sanity-check the rope texture scale before it goes over the wire
|
||||
if ( m_TextureScale < 0.1f )
|
||||
{
|
||||
Vector origin = GetAbsOrigin();
|
||||
GetEndPointPos( 0, origin );
|
||||
DevMsg( "move_rope has TextureScale less than 0.1 at (%2.2f, %2.2f, %2.2f)\n",
|
||||
origin.x, origin.y, origin.z );
|
||||
m_TextureScale = 0.1f;
|
||||
}
|
||||
else if ( m_TextureScale > 10.0f )
|
||||
{
|
||||
Vector origin = GetAbsOrigin();
|
||||
GetEndPointPos( 0, origin );
|
||||
DevMsg( "move_rope has TextureScale greater than 10 at (%2.2f, %2.2f, %2.2f)\n",
|
||||
origin.x, origin.y, origin.z );
|
||||
m_TextureScale = 10.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -341,7 +375,9 @@ void CRopeKeyframe::Activate()
|
||||
|
||||
// Legacy support..
|
||||
if ( m_iRopeMaterialModelIndex == -1 )
|
||||
{
|
||||
m_iRopeMaterialModelIndex = PrecacheModel( "cable/cable.vmt" );
|
||||
}
|
||||
|
||||
// Find the next entity in our chain.
|
||||
CBaseEntity *pEnt = gEntList.FindEntityByName( NULL, m_iNextLinkName );
|
||||
@@ -585,6 +621,8 @@ bool CRopeKeyframe::Break( void )
|
||||
//-----------------------------------------------------------------------------
|
||||
void CRopeKeyframe::NotifyPositionChanged( CBaseEntity *pEntity )
|
||||
{
|
||||
++m_nChangeCount;
|
||||
|
||||
// Update our bbox?
|
||||
UpdateBBox( false );
|
||||
|
||||
@@ -627,9 +665,17 @@ int CRopeKeyframe::OnTakeDamage( const CTakeDamageInfo &info )
|
||||
void CRopeKeyframe::Precache()
|
||||
{
|
||||
m_iRopeMaterialModelIndex = PrecacheModel( STRING( m_strRopeMaterialModel ) );
|
||||
PrecacheMaterial( "cable/rope_shadowdepth" );
|
||||
|
||||
BaseClass::Precache();
|
||||
}
|
||||
|
||||
void CRopeKeyframe::Spawn( void )
|
||||
{
|
||||
BaseClass::Spawn();
|
||||
Precache();
|
||||
}
|
||||
|
||||
|
||||
void CRopeKeyframe::DetachPoint( int iPoint )
|
||||
{
|
||||
@@ -650,22 +696,25 @@ void CRopeKeyframe::EnableCollision()
|
||||
void CRopeKeyframe::EnableWind( bool bEnable )
|
||||
{
|
||||
int flag = 0;
|
||||
if ( !bEnable )
|
||||
flag |= ROPE_NO_WIND;
|
||||
if ( bEnable )
|
||||
{
|
||||
flag |= ROPE_USE_WIND;
|
||||
}
|
||||
|
||||
if ( (m_RopeFlags & ROPE_NO_WIND) != flag )
|
||||
if ( (m_RopeFlags & ROPE_USE_WIND) != flag )
|
||||
{
|
||||
m_RopeFlags |= flag;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool CRopeKeyframe::KeyValue( const char *szKeyName, const char *szValue )
|
||||
{
|
||||
if( stricmp( szKeyName, "Breakable" ) == 0 )
|
||||
{
|
||||
if( atoi( szValue ) == 1 )
|
||||
{
|
||||
m_RopeFlags |= ROPE_BREAKABLE;
|
||||
}
|
||||
}
|
||||
else if( stricmp( szKeyName, "Collide" ) == 0 )
|
||||
{
|
||||
@@ -677,10 +726,19 @@ bool CRopeKeyframe::KeyValue( const char *szKeyName, const char *szValue )
|
||||
if( atoi( szValue ) == 1 )
|
||||
m_RopeFlags |= ROPE_BARBED;
|
||||
}
|
||||
else if( stricmp( szKeyName, "UseWind" ) == 0 )
|
||||
{
|
||||
if( atoi( szValue ) == 1 )
|
||||
{
|
||||
m_RopeFlags |= ROPE_USE_WIND;
|
||||
}
|
||||
}
|
||||
else if( stricmp( szKeyName, "Dangling" ) == 0 )
|
||||
{
|
||||
if( atoi( szValue ) == 1 )
|
||||
{
|
||||
m_fLockedPoints &= ~ROPE_LOCK_END_POINT; // detach our dest point
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -700,15 +758,15 @@ bool CRopeKeyframe::KeyValue( const char *szKeyName, const char *szValue )
|
||||
int iShader = atoi( szValue );
|
||||
if ( iShader == 0 )
|
||||
{
|
||||
m_iRopeMaterialModelIndex = PrecacheModel( "cable/cable.vmt" );
|
||||
m_strRopeMaterialModel = MAKE_STRING( "cable/cable.vmt" );
|
||||
}
|
||||
else if ( iShader == 1 )
|
||||
{
|
||||
m_iRopeMaterialModelIndex = PrecacheModel( "cable/rope.vmt" );
|
||||
m_strRopeMaterialModel = MAKE_STRING( "cable/rope.vmt" );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_iRopeMaterialModelIndex = PrecacheModel( "cable/chain.vmt" );
|
||||
m_strRopeMaterialModel = MAKE_STRING( "cable/chain.vmt" );
|
||||
}
|
||||
}
|
||||
else if ( stricmp( szKeyName, "RopeMaterial" ) == 0 )
|
||||
@@ -725,13 +783,6 @@ bool CRopeKeyframe::KeyValue( const char *szKeyName, const char *szValue )
|
||||
SetMaterial( str );
|
||||
}
|
||||
}
|
||||
else if ( stricmp( szKeyName, "NoWind" ) == 0 )
|
||||
{
|
||||
if ( atoi( szValue ) == 1 )
|
||||
{
|
||||
m_RopeFlags |= ROPE_NO_WIND;
|
||||
}
|
||||
}
|
||||
|
||||
return BaseClass::KeyValue( szKeyName, szValue );
|
||||
}
|
||||
@@ -749,7 +800,6 @@ void CRopeKeyframe::InputSetScrollSpeed( inputdata_t &inputdata )
|
||||
void CRopeKeyframe::SetMaterial( const char *pName )
|
||||
{
|
||||
m_strRopeMaterialModel = AllocPooledString( pName );
|
||||
m_iRopeMaterialModelIndex = PrecacheModel( STRING( m_strRopeMaterialModel ) );
|
||||
}
|
||||
|
||||
int CRopeKeyframe::UpdateTransmitState()
|
||||
|
||||
Reference in New Issue
Block a user