2013-12-02 19:31:46 -08:00
|
|
|
//========= Copyright Valve Corporation, All rights reserved. ============//
|
|
|
|
//
|
|
|
|
// Purpose:
|
|
|
|
//
|
|
|
|
// $NoKeywords: $
|
|
|
|
//=============================================================================//
|
|
|
|
|
|
|
|
#ifndef VARIANT_T_H
|
|
|
|
#define VARIANT_T_H
|
|
|
|
#ifdef _WIN32
|
|
|
|
#pragma once
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#include "ehandle.h"
|
|
|
|
#include "mathlib/vmatrix.h"
|
|
|
|
|
|
|
|
class CBaseEntity;
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// A variant class for passing data in entity input/output connections.
|
|
|
|
//
|
|
|
|
class variant_t
|
|
|
|
{
|
|
|
|
union
|
|
|
|
{
|
|
|
|
bool bVal;
|
|
|
|
string_t iszVal;
|
|
|
|
int iVal;
|
|
|
|
float flVal;
|
|
|
|
float vecVal[3];
|
|
|
|
color32 rgbaVal;
|
|
|
|
};
|
|
|
|
CHandle<CBaseEntity> eVal; // this can't be in the union because it has a constructor.
|
|
|
|
|
|
|
|
fieldtype_t fieldType;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
// constructor
|
|
|
|
variant_t() : fieldType(FIELD_VOID), iVal(0) {}
|
|
|
|
|
|
|
|
inline bool Bool( void ) const { return( fieldType == FIELD_BOOLEAN ) ? bVal : false; }
|
|
|
|
inline const char *String( void ) const { return( fieldType == FIELD_STRING ) ? STRING(iszVal) : ToString(); }
|
|
|
|
inline string_t StringID( void ) const { return( fieldType == FIELD_STRING ) ? iszVal : NULL_STRING; }
|
|
|
|
inline int Int( void ) const { return( fieldType == FIELD_INTEGER ) ? iVal : 0; }
|
|
|
|
inline float Float( void ) const { return( fieldType == FIELD_FLOAT ) ? flVal : 0; }
|
|
|
|
inline const CHandle<CBaseEntity> &Entity(void) const;
|
|
|
|
inline color32 Color32(void) const { return rgbaVal; }
|
|
|
|
inline void Vector3D(Vector &vec) const;
|
Mapbase v2.0; bulk commit
- Added custom map compile tools (vbsp, vvis, vrad)
- Changed blink fix (shouldn't change anything in-game)
- Added auto-completion to ent_create, npc_create, and the main set of "npc_" debug commands
- Added ent_create_aimed, an ent_create equivalent of npc_create_aimed
- Made hunters start using the "vs. player" melee animation against smaller NPCs that look weird with the "stab" attack
- Added "explosion_sparks" convar, which fixes broken code for giving explosions sparks (disabled by default because of how different it looks)
- Made interaction code capable of being dispatched on any entity, not just combat characters
- Added npc_barnacle_ignite convar, which lets barnacles be ignited by flares
- Fixed certain NPCs getting out of the way for the player when they hate them
- Fixed auto-generated "speak" scene responses not using parameters that work on real VCDs
- Made "stop_on_nonidle" capable of being used in any mod, not just HL2 episodic mods
- Selectable color for ragdoll boogie/point_ragdollboogie
- Fixed PickupWeaponInstant not firing weapon pickup outputs
- Introduced inputs and keyvalues for "lerping" to math_counter_advanced
- Fixed ClearConsole on logic_console
- logic_convar should now detect client convars correctly
- New NormalizeAngles input on math_vector
- logic_modelinfo LookupActivity input
- math_generate fixed and expanded to be more like math_counter
- Added a WIP game logging system for playtesting maps
- Introduced logic_playerinfo, an entity that can read a player's name or ID
- Fixed some new filters not working with filter_multi
- Added radius pickup spawnflag to func_physbox
- Added "Preserve name" spawnflag to weapons
- Added cc_achievement_debug message for when an achievement doesn't exist
- Made npc_combine_s not speak while in logic_choreographed_scenes
- Fixed zombie torsos/legs/headcrabs not being serverside when zombie is forced to server ragdoll
- Expanded and cleaned up npc_zombie_custom
- Fixed func_commandredirects not cleaning up correctly and sometimes crashing the game
- Allowed player squad commands to go through +USE-held objects
- Added a bunch of I/O/KV to trigger_waterydeath for better configuration
- Changed save comment system to use the chapter title from world properties, and the ability to suppress the title popup that normally results from it
- Adjusted game_convar_mod for MP planning
- Removed the func_precipitation custom particle/splash code for now, as it was causing problems
- Fixed env_global_light not accepting lightcolor
- Added "Additional Buttons" to player_speedmod
- Added save comment to RPC
- Added env_projectedtexture attenuation
- Added scripted_sequence OnPreIdleSequence
- Added OnCrab to zombies
- Added skill_changed game event (may need further testing)
- Added a fix for viewmodels flipping under extreme FOV values
- Added code that allows mappers to change the skin on shotgunners without it usually flipping back randomly
- Fixed a very, very, very major shader performance issue
- New SetAbsOrigin/Angles inputs on all entities, analogous to SetLocalOrigin/Angles
- Code improvements for I/O involving angles
- logic_entity_position improvements/fixes, including a new OutAngles output that outputs the angles on position calls
- Alternate collision/player avoidance spawnflag obsoletion enforcement disabled
- Enable/DisableHazardLights inputs on the EP2 jalopy, equivalent to the keyvalue
- Miscellaneous shader formatting adjustments and fixes
- Fixed AlwaysDrawOff on env_projectedtexture not being a valid input
2019-12-14 04:20:02 +00:00
|
|
|
#ifdef MAPBASE
|
|
|
|
// Gets angles from a vector
|
|
|
|
inline void Angle3D(QAngle &ang) const;
|
|
|
|
#endif
|
2013-12-02 19:31:46 -08:00
|
|
|
|
|
|
|
fieldtype_t FieldType( void ) { return fieldType; }
|
|
|
|
|
|
|
|
void SetBool( bool b ) { bVal = b; fieldType = FIELD_BOOLEAN; }
|
|
|
|
void SetString( string_t str ) { iszVal = str, fieldType = FIELD_STRING; }
|
|
|
|
void SetInt( int val ) { iVal = val, fieldType = FIELD_INTEGER; }
|
|
|
|
void SetFloat( float val ) { flVal = val, fieldType = FIELD_FLOAT; }
|
|
|
|
void SetEntity( CBaseEntity *val );
|
|
|
|
void SetVector3D( const Vector &val ) { vecVal[0] = val[0]; vecVal[1] = val[1]; vecVal[2] = val[2]; fieldType = FIELD_VECTOR; }
|
|
|
|
void SetPositionVector3D( const Vector &val ) { vecVal[0] = val[0]; vecVal[1] = val[1]; vecVal[2] = val[2]; fieldType = FIELD_POSITION_VECTOR; }
|
Mapbase v2.0; bulk commit
- Added custom map compile tools (vbsp, vvis, vrad)
- Changed blink fix (shouldn't change anything in-game)
- Added auto-completion to ent_create, npc_create, and the main set of "npc_" debug commands
- Added ent_create_aimed, an ent_create equivalent of npc_create_aimed
- Made hunters start using the "vs. player" melee animation against smaller NPCs that look weird with the "stab" attack
- Added "explosion_sparks" convar, which fixes broken code for giving explosions sparks (disabled by default because of how different it looks)
- Made interaction code capable of being dispatched on any entity, not just combat characters
- Added npc_barnacle_ignite convar, which lets barnacles be ignited by flares
- Fixed certain NPCs getting out of the way for the player when they hate them
- Fixed auto-generated "speak" scene responses not using parameters that work on real VCDs
- Made "stop_on_nonidle" capable of being used in any mod, not just HL2 episodic mods
- Selectable color for ragdoll boogie/point_ragdollboogie
- Fixed PickupWeaponInstant not firing weapon pickup outputs
- Introduced inputs and keyvalues for "lerping" to math_counter_advanced
- Fixed ClearConsole on logic_console
- logic_convar should now detect client convars correctly
- New NormalizeAngles input on math_vector
- logic_modelinfo LookupActivity input
- math_generate fixed and expanded to be more like math_counter
- Added a WIP game logging system for playtesting maps
- Introduced logic_playerinfo, an entity that can read a player's name or ID
- Fixed some new filters not working with filter_multi
- Added radius pickup spawnflag to func_physbox
- Added "Preserve name" spawnflag to weapons
- Added cc_achievement_debug message for when an achievement doesn't exist
- Made npc_combine_s not speak while in logic_choreographed_scenes
- Fixed zombie torsos/legs/headcrabs not being serverside when zombie is forced to server ragdoll
- Expanded and cleaned up npc_zombie_custom
- Fixed func_commandredirects not cleaning up correctly and sometimes crashing the game
- Allowed player squad commands to go through +USE-held objects
- Added a bunch of I/O/KV to trigger_waterydeath for better configuration
- Changed save comment system to use the chapter title from world properties, and the ability to suppress the title popup that normally results from it
- Adjusted game_convar_mod for MP planning
- Removed the func_precipitation custom particle/splash code for now, as it was causing problems
- Fixed env_global_light not accepting lightcolor
- Added "Additional Buttons" to player_speedmod
- Added save comment to RPC
- Added env_projectedtexture attenuation
- Added scripted_sequence OnPreIdleSequence
- Added OnCrab to zombies
- Added skill_changed game event (may need further testing)
- Added a fix for viewmodels flipping under extreme FOV values
- Added code that allows mappers to change the skin on shotgunners without it usually flipping back randomly
- Fixed a very, very, very major shader performance issue
- New SetAbsOrigin/Angles inputs on all entities, analogous to SetLocalOrigin/Angles
- Code improvements for I/O involving angles
- logic_entity_position improvements/fixes, including a new OutAngles output that outputs the angles on position calls
- Alternate collision/player avoidance spawnflag obsoletion enforcement disabled
- Enable/DisableHazardLights inputs on the EP2 jalopy, equivalent to the keyvalue
- Miscellaneous shader formatting adjustments and fixes
- Fixed AlwaysDrawOff on env_projectedtexture not being a valid input
2019-12-14 04:20:02 +00:00
|
|
|
#ifdef MAPBASE
|
|
|
|
// Passes in angles as a vector
|
|
|
|
void SetAngle3D( const QAngle &val ) { vecVal[0] = val[0]; vecVal[1] = val[1]; vecVal[2] = val[2]; fieldType = FIELD_VECTOR; }
|
|
|
|
#endif
|
2013-12-02 19:31:46 -08:00
|
|
|
void SetColor32( color32 val ) { rgbaVal = val; fieldType = FIELD_COLOR32; }
|
|
|
|
void SetColor32( int r, int g, int b, int a ) { rgbaVal.r = r; rgbaVal.g = g; rgbaVal.b = b; rgbaVal.a = a; fieldType = FIELD_COLOR32; }
|
|
|
|
void Set( fieldtype_t ftype, void *data );
|
|
|
|
void SetOther( void *data );
|
|
|
|
bool Convert( fieldtype_t newType );
|
2019-08-31 19:28:20 +00:00
|
|
|
#ifdef MAPBASE
|
|
|
|
// Special conversion specifically for FIELD_EHANDLE with !activator, etc.
|
|
|
|
bool Convert( fieldtype_t newType, CBaseEntity *pSelf, CBaseEntity *pActivator, CBaseEntity *pCaller );
|
|
|
|
// Hands over the value + the field type.
|
|
|
|
// ex: "Otis (String)", "3 (Integer)", or "npc_combine_s (Entity)"
|
|
|
|
const char *GetDebug();
|
|
|
|
#endif
|
2013-12-02 19:31:46 -08:00
|
|
|
|
|
|
|
static typedescription_t m_SaveBool[];
|
|
|
|
static typedescription_t m_SaveInt[];
|
|
|
|
static typedescription_t m_SaveFloat[];
|
|
|
|
static typedescription_t m_SaveEHandle[];
|
|
|
|
static typedescription_t m_SaveString[];
|
|
|
|
static typedescription_t m_SaveColor[];
|
|
|
|
static typedescription_t m_SaveVector[];
|
|
|
|
static typedescription_t m_SavePositionVector[];
|
|
|
|
static typedescription_t m_SaveVMatrix[];
|
|
|
|
static typedescription_t m_SaveVMatrixWorldspace[];
|
|
|
|
static typedescription_t m_SaveMatrix3x4Worldspace[];
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
//
|
|
|
|
// Returns a string representation of the value without modifying the variant.
|
|
|
|
//
|
|
|
|
const char *ToString( void ) const;
|
|
|
|
|
|
|
|
friend class CVariantSaveDataOps;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Purpose: Returns this variant as a vector.
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
inline void variant_t::Vector3D(Vector &vec) const
|
|
|
|
{
|
|
|
|
if (( fieldType == FIELD_VECTOR ) || ( fieldType == FIELD_POSITION_VECTOR ))
|
|
|
|
{
|
|
|
|
vec[0] = vecVal[0];
|
|
|
|
vec[1] = vecVal[1];
|
|
|
|
vec[2] = vecVal[2];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
vec = vec3_origin;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Mapbase v2.0; bulk commit
- Added custom map compile tools (vbsp, vvis, vrad)
- Changed blink fix (shouldn't change anything in-game)
- Added auto-completion to ent_create, npc_create, and the main set of "npc_" debug commands
- Added ent_create_aimed, an ent_create equivalent of npc_create_aimed
- Made hunters start using the "vs. player" melee animation against smaller NPCs that look weird with the "stab" attack
- Added "explosion_sparks" convar, which fixes broken code for giving explosions sparks (disabled by default because of how different it looks)
- Made interaction code capable of being dispatched on any entity, not just combat characters
- Added npc_barnacle_ignite convar, which lets barnacles be ignited by flares
- Fixed certain NPCs getting out of the way for the player when they hate them
- Fixed auto-generated "speak" scene responses not using parameters that work on real VCDs
- Made "stop_on_nonidle" capable of being used in any mod, not just HL2 episodic mods
- Selectable color for ragdoll boogie/point_ragdollboogie
- Fixed PickupWeaponInstant not firing weapon pickup outputs
- Introduced inputs and keyvalues for "lerping" to math_counter_advanced
- Fixed ClearConsole on logic_console
- logic_convar should now detect client convars correctly
- New NormalizeAngles input on math_vector
- logic_modelinfo LookupActivity input
- math_generate fixed and expanded to be more like math_counter
- Added a WIP game logging system for playtesting maps
- Introduced logic_playerinfo, an entity that can read a player's name or ID
- Fixed some new filters not working with filter_multi
- Added radius pickup spawnflag to func_physbox
- Added "Preserve name" spawnflag to weapons
- Added cc_achievement_debug message for when an achievement doesn't exist
- Made npc_combine_s not speak while in logic_choreographed_scenes
- Fixed zombie torsos/legs/headcrabs not being serverside when zombie is forced to server ragdoll
- Expanded and cleaned up npc_zombie_custom
- Fixed func_commandredirects not cleaning up correctly and sometimes crashing the game
- Allowed player squad commands to go through +USE-held objects
- Added a bunch of I/O/KV to trigger_waterydeath for better configuration
- Changed save comment system to use the chapter title from world properties, and the ability to suppress the title popup that normally results from it
- Adjusted game_convar_mod for MP planning
- Removed the func_precipitation custom particle/splash code for now, as it was causing problems
- Fixed env_global_light not accepting lightcolor
- Added "Additional Buttons" to player_speedmod
- Added save comment to RPC
- Added env_projectedtexture attenuation
- Added scripted_sequence OnPreIdleSequence
- Added OnCrab to zombies
- Added skill_changed game event (may need further testing)
- Added a fix for viewmodels flipping under extreme FOV values
- Added code that allows mappers to change the skin on shotgunners without it usually flipping back randomly
- Fixed a very, very, very major shader performance issue
- New SetAbsOrigin/Angles inputs on all entities, analogous to SetLocalOrigin/Angles
- Code improvements for I/O involving angles
- logic_entity_position improvements/fixes, including a new OutAngles output that outputs the angles on position calls
- Alternate collision/player avoidance spawnflag obsoletion enforcement disabled
- Enable/DisableHazardLights inputs on the EP2 jalopy, equivalent to the keyvalue
- Miscellaneous shader formatting adjustments and fixes
- Fixed AlwaysDrawOff on env_projectedtexture not being a valid input
2019-12-14 04:20:02 +00:00
|
|
|
#ifdef MAPBASE
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Purpose: Returns this variant as angles.
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
inline void variant_t::Angle3D(QAngle &ang) const
|
|
|
|
{
|
|
|
|
if (( fieldType == FIELD_VECTOR ) || ( fieldType == FIELD_POSITION_VECTOR ))
|
|
|
|
{
|
|
|
|
ang[0] = vecVal[0];
|
|
|
|
ang[1] = vecVal[1];
|
|
|
|
ang[2] = vecVal[2];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ang = vec3_angle;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-12-02 19:31:46 -08:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Purpose: Returns this variant as an EHANDLE.
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
inline const CHandle<CBaseEntity> &variant_t::Entity(void) const
|
|
|
|
{
|
|
|
|
if ( fieldType == FIELD_EHANDLE )
|
|
|
|
return eVal;
|
|
|
|
|
|
|
|
static CHandle<CBaseEntity> hNull;
|
|
|
|
hNull.Set(NULL);
|
|
|
|
return(hNull);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif // VARIANT_T_H
|