mirror of
https://github.com/celisej567/source-sdk-2013.git
synced 2026-09-23 20:09:45 +03:00
Mapbase v4.1
- Exposed CAmmoDef to VScript and changed ammo type functions accordingly - Added TakeHealth and IsAlive to CBaseEntity - Added $treeSway - Added several inputs to control env_wind keyvalues + a new $treeSway scale keyvalue - Added "Expanded name fixup" keyvalue to point_template which allows name fixup to fix up output parameters - Fixed the rope on rappelling NPCs causing graphical issues - Fixed prop_vehicle_prisoner_pod missing "EnterVehicle", "EnterVehicleImmediate", and "ExitVehicle" inputs - Fixed hostile citizens not damaging player - Fixed an uncommon npc_metropolice crash from when it's not in a squad - Made SetTarget input update target handling on NPCs - Changed ammo type functions to be more organized, added AmmoDef singleton - Added more precache functions - Added various misc. entity functions, like GetAllWeapons or AddOutput - Added more utility functions
This commit is contained in:
@@ -70,6 +70,9 @@
|
||||
#include "IEffects.h"
|
||||
#include "engine/IEngineSound.h"
|
||||
#include "sharedInterface.h"
|
||||
#ifdef CLIENT_DLL
|
||||
#include "renderparm.h"
|
||||
#endif
|
||||
|
||||
// memdbgon must be the last include file in a .cpp file!!!
|
||||
#include "tier0/memdbgon.h"
|
||||
@@ -89,6 +92,7 @@ CEnvWindShared::CEnvWindShared() : m_WindAveQueue(10), m_WindVariationQueue(10)
|
||||
#ifdef MAPBASE
|
||||
s_windControllers.AddToTail( this );
|
||||
m_windRadius = -1.0f;
|
||||
m_flTreeSwayScale = 1.0f;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -180,6 +184,31 @@ void CEnvWindShared::UpdateWindSound( float flTotalWindSpeed )
|
||||
}
|
||||
|
||||
|
||||
#ifdef MAPBASE
|
||||
#define TREE_SWAY_UPDATE_TIME 2.0f
|
||||
|
||||
void CEnvWindShared::UpdateTreeSway( float flTime )
|
||||
{
|
||||
#ifdef CLIENT_DLL
|
||||
while( flTime >= m_flSwayTime )
|
||||
{
|
||||
// Since the wind is constantly changing, but we need smooth values, we cache them off here.
|
||||
m_PrevSwayVector = m_CurrentSwayVector;
|
||||
m_CurrentSwayVector = m_flTreeSwayScale != 1.0f ? (m_currentWindVector * m_flTreeSwayScale) : m_currentWindVector;
|
||||
m_flSwayTime += TREE_SWAY_UPDATE_TIME;
|
||||
}
|
||||
|
||||
// Update vertex shader
|
||||
float flPercentage = ( 1 - ( ( m_flSwayTime - flTime ) / TREE_SWAY_UPDATE_TIME ) );
|
||||
CMatRenderContextPtr pRenderContext( g_pMaterialSystem );
|
||||
// Dividing by 2 helps the numbers the shader is expecting stay in line with other expected game values.
|
||||
Vector vecWind = Lerp( flPercentage, m_PrevSwayVector, m_CurrentSwayVector ) / 25.f;
|
||||
pRenderContext->SetVectorRenderingParameter( VECTOR_RENDERPARM_WIND_DIRECTION, vecWind );
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Updates the wind speed
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -196,6 +225,14 @@ float CEnvWindShared::WindThink( float flTime )
|
||||
|
||||
ComputeWindVariation( flTime );
|
||||
|
||||
#if defined(MAPBASE) && defined(CLIENT_DLL)
|
||||
if (m_flTreeSwayScale != 0.0f)
|
||||
{
|
||||
// Update Tree Sway
|
||||
UpdateTreeSway( flTime );
|
||||
}
|
||||
#endif
|
||||
|
||||
while (true)
|
||||
{
|
||||
// First, simulate up to the next switch time...
|
||||
|
||||
Reference in New Issue
Block a user