upload "kind" alien swarm

This commit is contained in:
nillerusr
2023-10-03 17:23:56 +03:00
parent b7bd94c52e
commit 7d3c0d8b5a
4229 changed files with 462903 additions and 495158 deletions

View File

@@ -1,4 +1,4 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//========= Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: A point entity that periodically emits sparks and "bzzt" sounds.
//
@@ -8,7 +8,6 @@
#include "cbase.h"
#include "IEffects.h"
#include "engine/IEngineSound.h"
#include "envspark.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
@@ -28,11 +27,41 @@ void DoSpark( CBaseEntity *ent, const Vector &location, int nMagnitude, int nTra
}
}
const int SF_SPARK_START_ON = 64;
const int SF_SPARK_GLOW = 128;
const int SF_SPARK_SILENT = 256;
const int SF_SPARK_DIRECTIONAL = 512;
class CEnvSpark : public CPointEntity
{
DECLARE_CLASS( CEnvSpark, CPointEntity );
public:
CEnvSpark( void );
void Spawn(void);
void Precache(void);
void SparkThink(void);
// Input handlers
void InputStartSpark( inputdata_t &inputdata );
void InputStopSpark( inputdata_t &inputdata );
void InputToggleSpark( inputdata_t &inputdata );
void InputSparkOnce( inputdata_t &inputdata );
DECLARE_DATADESC();
float m_flDelay;
int m_nGlowSpriteIndex;
int m_nMagnitude;
int m_nTrailLength;
COutputEvent m_OnSpark;
};
BEGIN_DATADESC( CEnvSpark )
DEFINE_KEYFIELD( m_flDelay, FIELD_FLOAT, "MaxDelay" ),
@@ -53,7 +82,7 @@ BEGIN_DATADESC( CEnvSpark )
END_DATADESC()
LINK_ENTITY_TO_CLASS( env_spark, CEnvSpark );
LINK_ENTITY_TO_CLASS(env_spark, CEnvSpark);
//-----------------------------------------------------------------------------
@@ -74,27 +103,19 @@ void CEnvSpark::Spawn(void)
SetThink( NULL );
SetUse( NULL );
if ( FBitSet(m_spawnflags, SF_SPARK_START_ON ) )
if (FBitSet(m_spawnflags, SF_SPARK_START_ON))
{
SetThink( &CEnvSpark::SparkThink ); // start sparking
SetThink(&CEnvSpark::SparkThink); // start sparking
}
SetNextThink( gpGlobals->curtime + 0.1 + random->RandomFloat( 0, 1.5 ) );
// Negative delays are not allowed
if ( m_flDelay < 0 )
if (m_flDelay < 0)
{
m_flDelay = 0;
}
#ifdef HL1_DLL
// Don't allow 0 delays in HL1 Port. Enforce a default
if( m_flDelay == 0 )
{
m_flDelay = 1.0f;
}
#endif//HL1_DLL
Precache( );
}
@@ -104,9 +125,15 @@ void CEnvSpark::Spawn(void)
//-----------------------------------------------------------------------------
void CEnvSpark::Precache(void)
{
m_nGlowSpriteIndex = PrecacheModel( "sprites/glow01.vmt" );
// Unlock string tables to avoid an engine warning
bool oldLock = engine->LockNetworkStringTables( false );
m_nGlowSpriteIndex = PrecacheModel("sprites/glow01.vmt");
engine->LockNetworkStringTables( oldLock );
PrecacheScriptSound( "DoSpark" );
if ( IsPrecacheAllowed() )
{
PrecacheScriptSound( "DoSpark" );
}
}
extern ConVar phys_pushscale;
@@ -135,20 +162,13 @@ void CEnvSpark::SparkThink(void)
}
}
//-----------------------------------------------------------------------------
// Purpose: Input handler for starting the sparks.
//-----------------------------------------------------------------------------
void CEnvSpark::InputStartSpark( inputdata_t &inputdata )
{
StartSpark();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CEnvSpark::StartSpark( void )
{
SetThink( &CEnvSpark::SparkThink );
SetThink(&CEnvSpark::SparkThink);
SetNextThink( gpGlobals->curtime );
}
@@ -166,23 +186,16 @@ void CEnvSpark::InputSparkOnce( inputdata_t &inputdata )
//-----------------------------------------------------------------------------
void CEnvSpark::InputStopSpark( inputdata_t &inputdata )
{
StopSpark();
SetThink(NULL);
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CEnvSpark::StopSpark( void )
{
SetThink( NULL );
}
//-----------------------------------------------------------------------------
// Purpose: Input handler for toggling the on/off state of the sparks.
//-----------------------------------------------------------------------------
void CEnvSpark::InputToggleSpark( inputdata_t &inputdata )
{
if ( GetNextThink() == TICK_NEVER_THINK )
if (GetNextThink() == TICK_NEVER_THINK)
{
InputStartSpark( inputdata );
}