mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-01-09 05:35:30 +03:00
eb014cce6c
- Fixed path_track paths saving as pointers instead of handles - Fixed player animations not falling to base class correctly - Fixed logic_externaldata creating garbage in trailing spaces - Added "SetHandModelSkin" input - Added unique colors for various types of console message, adjustable via convars - Added the ability to use map-specific weapon scripts - Added a way to display (placeholder) text entirely from Faceposer scenes - Added "autobreak" keyvalue to game_text, which automatically breaks long text into different lines - Added the ability to change a game_text's font (very limited) - Added LightToggle input to point_spotlight - Added Enable/DisableSprites on npc_manhack - Added ai_goal_police behavior from metrocops to Combine soldiers and citizens - Added func_precipitation particle rain systems from the Alien Swarm SDK - Added new func_precipitation spawnflags for controlling behavior in particle types - Added "mapbase_version" cvar which shows the version of Mapbase a mod might be running on - Fixed an oversight with NPC crouch activities which was causing npc_metropolice to stop firing in standoffs - Added toggleable patches to npc_combine AI which make soldiers less likely to stand around without shooting or rush to melee when not needed - Added key for custom logo font on env_credits scripts - Added SetSpeed and SetPushDir inputs for trigger_push - Added a bunch of I/O/KV to func_fish_pool to allow for more control over the fish - Added OnLostEnemy/Player support for npc_combine_camera - Added enhanced save/restore for the Response System, toggleable via convar - Added a convar which allows users to disable weapon autoswitching when picking up ammo - Split VScript base script into its own file - Added VScript descriptions for NPC squads and the manager class which handles them - Moved several classes, functions, etc. to the VScript library itself for future usage in other projects, like VBSP - Added VScript to VBSP with basic map file interfacing - Made some VScript documentation more clear due to deprecation of online documentation - Added VScript "hook" registration, creating a standardized system which shows up in script_help documentation - Added VScript-driven custom weapons - Added clientside VScript scopes - Added a bunch of weapon-related VScript functions - Split a bunch of cluttered VScript stuff into different files - Added VScript functions for "following" entities/bonemerging - Added VScript functions for grenades - Added a few more VScript trigger functions - Added OnDeath hook for VScript - Fixed documentation for aliased functions in VScript - Fixed $bumpmask not working on SDK_LightmappedGeneric - Made vertex blend swapping in Hammer use a constant instead of a combo (makes it easier to compile the shader, especially for $bumpmask's sake) - Fixed brush phong, etc. causing SDK_WorldVertexTransition to stop working - Added limited support for $envmapmask in the bumpmapping shader - Fixed more issues with parallax corrected cubemaps and instances - Made instance variable recursion consistent with VMFII
188 lines
5.2 KiB
C++
188 lines
5.2 KiB
C++
//========= Copyright Valve Corporation, All rights reserved. ============//
|
|
//
|
|
// Purpose:
|
|
//
|
|
//=============================================================================//
|
|
|
|
#ifndef C_EFFECTS_H
|
|
#define C_EFFECTS_H
|
|
#ifdef _WIN32
|
|
#pragma once
|
|
#endif
|
|
|
|
#include "cbase.h"
|
|
#include "precipitation_shared.h"
|
|
|
|
// Draw rain effects.
|
|
void DrawPrecipitation();
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Precipitation particle type
|
|
//-----------------------------------------------------------------------------
|
|
|
|
class CPrecipitationParticle
|
|
{
|
|
public:
|
|
Vector m_Pos;
|
|
Vector m_Velocity;
|
|
float m_SpawnTime; // Note: Tweak with this to change lifetime
|
|
float m_Mass;
|
|
float m_Ramp;
|
|
|
|
float m_flCurLifetime;
|
|
float m_flMaxLifetime;
|
|
};
|
|
|
|
|
|
class CClient_Precipitation;
|
|
static CUtlVector<CClient_Precipitation*> g_Precipitations;
|
|
|
|
//===========
|
|
// Snow fall
|
|
//===========
|
|
class CSnowFallManager;
|
|
static CSnowFallManager *s_pSnowFallMgr = NULL;
|
|
bool SnowFallManagerCreate( CClient_Precipitation *pSnowEntity );
|
|
void SnowFallManagerDestroy( void );
|
|
|
|
class AshDebrisEffect : public CSimpleEmitter
|
|
{
|
|
public:
|
|
AshDebrisEffect( const char *pDebugName ) : CSimpleEmitter( pDebugName ) {}
|
|
|
|
static AshDebrisEffect* Create( const char *pDebugName );
|
|
|
|
virtual float UpdateAlpha( const SimpleParticle *pParticle );
|
|
virtual float UpdateRoll( SimpleParticle *pParticle, float timeDelta );
|
|
|
|
private:
|
|
AshDebrisEffect( const AshDebrisEffect & );
|
|
};
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// Precipitation base entity
|
|
//-----------------------------------------------------------------------------
|
|
|
|
class CClient_Precipitation : public C_BaseEntity
|
|
{
|
|
class CPrecipitationEffect;
|
|
friend class CClient_Precipitation::CPrecipitationEffect;
|
|
|
|
public:
|
|
DECLARE_CLASS( CClient_Precipitation, C_BaseEntity );
|
|
DECLARE_CLIENTCLASS();
|
|
|
|
CClient_Precipitation();
|
|
virtual ~CClient_Precipitation();
|
|
|
|
// Inherited from C_BaseEntity
|
|
virtual void Precache( );
|
|
|
|
void Render();
|
|
|
|
private:
|
|
|
|
// Creates a single particle
|
|
CPrecipitationParticle* CreateParticle();
|
|
|
|
virtual void OnDataChanged( DataUpdateType_t updateType );
|
|
virtual void ClientThink();
|
|
|
|
void Simulate( float dt );
|
|
|
|
// Renders the particle
|
|
void RenderParticle( CPrecipitationParticle* pParticle, CMeshBuilder &mb );
|
|
|
|
void CreateWaterSplashes();
|
|
|
|
// Emits the actual particles
|
|
void EmitParticles( float fTimeDelta );
|
|
|
|
// Computes where we're gonna emit
|
|
bool ComputeEmissionArea( Vector& origin, Vector2D& size );
|
|
|
|
// Gets the tracer width and speed
|
|
float GetWidth() const;
|
|
float GetLength() const;
|
|
float GetSpeed() const;
|
|
|
|
// Gets the remaining lifetime of the particle
|
|
float GetRemainingLifetime( CPrecipitationParticle* pParticle ) const;
|
|
|
|
// Computes the wind vector
|
|
static void ComputeWindVector( );
|
|
|
|
// simulation methods
|
|
bool SimulateRain( CPrecipitationParticle* pParticle, float dt );
|
|
bool SimulateSnow( CPrecipitationParticle* pParticle, float dt );
|
|
|
|
void PrecacheParticlePrecip( void );
|
|
void CreateParticlePrecip( void );
|
|
void InitializeParticlePrecip( void );
|
|
void DispatchOuterParticlePrecip( C_BasePlayer *pPlayer, Vector vForward );
|
|
void DispatchInnerParticlePrecip( C_BasePlayer *pPlayer, Vector vForward );
|
|
void DestroyOuterParticlePrecip( void );
|
|
void DestroyInnerParticlePrecip( void );
|
|
|
|
void UpdateParticlePrecip( C_BasePlayer *pPlayer );
|
|
|
|
private:
|
|
void CreateAshParticle( void );
|
|
void CreateRainOrSnowParticle( Vector vSpawnPosition, Vector vVelocity );
|
|
|
|
// Information helpful in creating and rendering particles
|
|
IMaterial *m_MatHandle; // material used
|
|
|
|
float m_Color[4]; // precip color
|
|
float m_Lifetime; // Precip lifetime
|
|
float m_InitialRamp; // Initial ramp value
|
|
float m_Speed; // Precip speed
|
|
float m_Width; // Tracer width
|
|
float m_Remainder; // particles we should render next time
|
|
PrecipitationType_t m_nPrecipType; // Precip type
|
|
float m_flHalfScreenWidth; // Precalculated each frame.
|
|
|
|
float m_flDensity;
|
|
|
|
#ifdef MAPBASE
|
|
int m_spawnflags;
|
|
#endif
|
|
|
|
// Some state used in rendering and simulation
|
|
// Used to modify the rain density and wind from the console
|
|
static ConVar s_raindensity;
|
|
static ConVar s_rainwidth;
|
|
static ConVar s_rainlength;
|
|
static ConVar s_rainspeed;
|
|
|
|
static Vector s_WindVector; // Stores the wind speed vector
|
|
|
|
CUtlLinkedList<CPrecipitationParticle> m_Particles;
|
|
CUtlVector<Vector> m_Splashes;
|
|
|
|
CSmartPtr<AshDebrisEffect> m_pAshEmitter;
|
|
TimedEvent m_tAshParticleTimer;
|
|
TimedEvent m_tAshParticleTraceTimer;
|
|
bool m_bActiveAshEmitter;
|
|
Vector m_vAshSpawnOrigin;
|
|
|
|
int m_iAshCount;
|
|
|
|
protected:
|
|
float m_flParticleInnerDist; //The distance at which to start drawing the inner system
|
|
char *m_pParticleInnerNearDef; //Name of the first inner system
|
|
char *m_pParticleInnerFarDef; //Name of the second inner system
|
|
char *m_pParticleOuterDef; //Name of the outer system
|
|
HPARTICLEFFECT m_pParticlePrecipInnerNear;
|
|
HPARTICLEFFECT m_pParticlePrecipInnerFar;
|
|
HPARTICLEFFECT m_pParticlePrecipOuter;
|
|
TimedEvent m_tParticlePrecipTraceTimer;
|
|
bool m_bActiveParticlePrecipEmitter;
|
|
bool m_bParticlePrecipInitialized;
|
|
|
|
private:
|
|
CClient_Precipitation( const CClient_Precipitation & ); // not defined, not accessible
|
|
};
|
|
|
|
#endif // C_EFFECTS_H
|