2013-12-02 19:31:46 -08:00
|
|
|
//========= Copyright Valve Corporation, All rights reserved. ============//
|
|
|
|
//
|
|
|
|
// Purpose: Controls the pose parameters of a model
|
|
|
|
//
|
|
|
|
//===========================================================================//
|
|
|
|
|
|
|
|
|
|
|
|
#define MAX_POSE_CONTROLLED_PROPS 4 // Number of entities by the same name that can be controlled
|
|
|
|
|
|
|
|
|
|
|
|
// Type of frequency modulations
|
|
|
|
enum PoseController_FModType_t
|
|
|
|
{
|
|
|
|
POSECONTROLLER_FMODTYPE_NONE = 0,
|
|
|
|
POSECONTROLLER_FMODTYPE_SINE,
|
|
|
|
POSECONTROLLER_FMODTYPE_SQUARE,
|
|
|
|
POSECONTROLLER_FMODTYPE_TRIANGLE,
|
|
|
|
POSECONTROLLER_FMODTYPE_SAWTOOTH,
|
|
|
|
POSECONTROLLER_FMODTYPE_NOISE,
|
|
|
|
|
|
|
|
POSECONTROLLER_FMODTYPE_TOTAL,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef CLIENT_DLL
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// SERVER CLASS
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "baseentity.h"
|
|
|
|
|
|
|
|
|
|
|
|
class CPoseController : public CBaseEntity
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DECLARE_CLASS( CPoseController, CBaseEntity );
|
|
|
|
DECLARE_SERVERCLASS();
|
|
|
|
DECLARE_DATADESC();
|
|
|
|
|
|
|
|
virtual void Spawn( void );
|
|
|
|
|
|
|
|
void Think( void );
|
|
|
|
|
|
|
|
void BuildPropList( void );
|
|
|
|
void BuildPoseIndexList( void );
|
|
|
|
void SetPoseIndex( int i, int iValue );
|
|
|
|
void SetCurrentPose( float fCurrentPoseValue );
|
|
|
|
|
|
|
|
float GetPoseValue( void );
|
|
|
|
|
|
|
|
void SetProp( CBaseAnimating *pProp );
|
|
|
|
void SetPropName( const char *pName );
|
|
|
|
void SetPoseParameterName( const char *pName );
|
|
|
|
void SetPoseValue( float fValue );
|
|
|
|
void SetInterpolationTime( float fValue );
|
|
|
|
void SetInterpolationWrap( bool bWrap );
|
|
|
|
void SetCycleFrequency( float fValue );
|
|
|
|
void SetFModType( int nType );
|
|
|
|
void SetFModTimeOffset( float fValue );
|
|
|
|
void SetFModRate( float fValue );
|
|
|
|
void SetFModAmplitude( float fValue );
|
|
|
|
void RandomizeFMod( float fExtremeness );
|
|
|
|
|
|
|
|
// Input handlers
|
|
|
|
void InputSetPoseParameterName( inputdata_t &inputdata );
|
|
|
|
void InputSetPoseValue( inputdata_t &inputdata );
|
|
|
|
void InputSetInterpolationTime( inputdata_t &inputdata );
|
|
|
|
void InputSetCycleFrequency( inputdata_t &inputdata );
|
|
|
|
void InputSetFModType( inputdata_t &inputdata );
|
|
|
|
void InputSetFModTimeOffset( inputdata_t &inputdata );
|
|
|
|
void InputSetFModRate( inputdata_t &inputdata );
|
|
|
|
void InputSetFModAmplitude( inputdata_t &inputdata );
|
|
|
|
void InputRandomizeFMod( inputdata_t &inputdata );
|
|
|
|
void InputGetFMod( inputdata_t &inputdata );
|
|
|
|
|
Mapbase v3.0
- Overhauled matcher system and added expanded wildcard support, meaning "text", "te?t", "blah_test", etc. are now supported instead of only trailing *
- Added support for regular expression matching
- Added the missing matrixinvert.h file, which prevented programmers from compiling vbsp
- Fixed env_global_light brightness
- Added info_player_view_proxy, an entity which mimics a player's view (created for script_intro)
- New UnZoomWithRate and SetZoomRate inputs on env_zoom
- New "Don't change target's angles" flag on logic_measure_movement
- Fixed logic_measure_movement not using ignore origin flags correctly
- Fixed filter_damage_mod secondary filter not recognizing mode correctly
- Fixed DisableGeigerCounter causing NPCs to ignore player, and possibly fixed other adverse effects in similar code
- Added SetEntityName input for setting an entity's targetname
- Added "SetTarget" support to point_posecontroller
- Added "sk_alyx_health" convar for adjustable npc_alyx health, restored/fixed "sk_barney_health" for adjustable npc_barney health
- Added ignore flags and several direction-related inputs to math_vector
- Added pose parameter stuff to logic_modelinfo
- Fixed ChangeWeapon not changing during combat
- Fixed holster/unholster on NPCs without holster/unholster animations
- Fixed func_tank and other "player in the way" code ignoring notarget
- Added SetPoseParameter input to animating entities
- Introduced an experimental chapter system which allows for custom chapter title/restriction management
- Added SetChapterTitle input to worldspawn for dynamic title changing
- Fixed func_tankairboatgun damage credit, added ability to use its damage keyvalues
- Fixed mapbase_rpc_enabled not actually affecting RPC
- Moved some newly found Combine soldier grenade code to ai_grenade for other grenade users
- Fixed some problems with the new shared activities
- Restored an old Mapbase entity as "prop_interactable", an entity which contains all of the functionality of a func_button/func_door in a prop entity
- Added env_microphone pitch scale for scaling the pitch of transmitted sounds
- Added experimental, long-overdue code for scenes to be able to access !target#'s and other scene-related names through AI_INPUT
- Added "mat_specular_disable_on_missing", which "disables" specular reflections when the cubemap texture is missing
- Fixed $envmapmasktransform and $bumptransform on VertexLitGeneric and related shaders
- Areaportal leaks now stop compilation in leaktest
- Replaced "-nodefaultcubemap" with "-defaultcubemap" as the shader changes allow maps to compile without default cubemaps by default with little effect
2020-02-05 19:08:49 +00:00
|
|
|
#ifdef MAPBASE
|
|
|
|
void InputSetTarget( inputdata_t &inputdata );
|
|
|
|
#endif
|
|
|
|
|
2013-12-02 19:31:46 -08:00
|
|
|
private:
|
|
|
|
|
|
|
|
CNetworkArray( EHANDLE, m_hProps, MAX_POSE_CONTROLLED_PROPS ); // Handles to controlled models
|
|
|
|
CNetworkArray( unsigned char, m_chPoseIndex, MAX_POSE_CONTROLLED_PROPS ); // Pose parameter indices for each model
|
|
|
|
|
|
|
|
bool m_bDisablePropLookup;
|
|
|
|
|
|
|
|
CNetworkVar( bool, m_bPoseValueParity );
|
|
|
|
|
|
|
|
string_t m_iszPropName; // Targetname of the models to control
|
|
|
|
string_t m_iszPoseParameterName; // Pose parameter name to control
|
|
|
|
|
|
|
|
CNetworkVar( float, m_fPoseValue ); // Normalized pose parameter value (maps to each pose parameter's min and max range)
|
|
|
|
CNetworkVar( float, m_fInterpolationTime ); // Interpolation speed for client matching absolute pose values
|
|
|
|
CNetworkVar( bool, m_bInterpolationWrap ); // Interpolation for the client wraps 0 to 1.
|
|
|
|
|
|
|
|
CNetworkVar( float, m_fCycleFrequency ); // Cycles per second
|
|
|
|
|
|
|
|
// Frequency modulation variables
|
|
|
|
CNetworkVar( PoseController_FModType_t, m_nFModType );
|
|
|
|
CNetworkVar( float, m_fFModTimeOffset );
|
|
|
|
CNetworkVar( float, m_fFModRate );
|
|
|
|
CNetworkVar( float, m_fFModAmplitude );
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#else //#ifndef CLIENT_DLL
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// CLIENT CLASS
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "c_baseentity.h"
|
|
|
|
#include "fx_interpvalue.h"
|
|
|
|
|
|
|
|
|
|
|
|
class C_PoseController : public C_BaseEntity
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DECLARE_CLASS( C_PoseController, C_BaseEntity );
|
|
|
|
DECLARE_CLIENTCLASS();
|
|
|
|
|
|
|
|
virtual void Spawn( void );
|
|
|
|
virtual void OnDataChanged( DataUpdateType_t updateType );
|
|
|
|
|
|
|
|
virtual void ClientThink( void );
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
void UpdateModulation( void );
|
|
|
|
void UpdatePoseCycle( float fCycleAmount );
|
|
|
|
void SetCurrentPose( float fCurrentPoseValue );
|
|
|
|
|
|
|
|
|
|
|
|
// Networked variables
|
|
|
|
EHANDLE m_hProps[MAX_POSE_CONTROLLED_PROPS];
|
|
|
|
unsigned char m_chPoseIndex[MAX_POSE_CONTROLLED_PROPS];
|
|
|
|
bool m_bPoseValueParity;
|
|
|
|
float m_fPoseValue;
|
|
|
|
float m_fInterpolationTime;
|
|
|
|
bool m_bInterpolationWrap;
|
|
|
|
float m_fCycleFrequency;
|
|
|
|
PoseController_FModType_t m_nFModType;
|
|
|
|
float m_fFModTimeOffset;
|
|
|
|
float m_fFModRate;
|
|
|
|
float m_fFModAmplitude;
|
|
|
|
bool m_bOldPoseValueParity;
|
|
|
|
|
|
|
|
float m_fCurrentPoseValue; // Actual pose value cycled by the frequency and modulation
|
|
|
|
float m_fCurrentFMod; // The current fequency modulation amount (stored for noise walk)
|
|
|
|
|
|
|
|
CInterpolatedValue m_PoseTransitionValue;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-06-26 15:22:04 -07:00
|
|
|
#endif //#ifndef CLIENT_DLL
|