2019-08-31 22:28:20 +03:00
|
|
|
//========= Copyright 1996-2010, Valve Corporation, All rights reserved. ============//
|
|
|
|
//
|
|
|
|
// Purpose: global dynamic light. Ported from Insolence's port of Alien Swarm's env_global_light.
|
|
|
|
//
|
|
|
|
// $NoKeywords: $
|
|
|
|
//=============================================================================//
|
|
|
|
|
|
|
|
#include "cbase.h"
|
|
|
|
|
|
|
|
// memdbgon must be the last include file in a .cpp file!!!
|
|
|
|
#include "tier0/memdbgon.h"
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// FIXME: This really should inherit from something more lightweight
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Purpose : Sunlight shadow control entity
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
class CGlobalLight : public CBaseEntity
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DECLARE_CLASS( CGlobalLight, CBaseEntity );
|
|
|
|
|
|
|
|
CGlobalLight();
|
|
|
|
|
|
|
|
void Spawn( void );
|
|
|
|
bool KeyValue( const char *szKeyName, const char *szValue );
|
|
|
|
virtual bool GetKeyValue( const char *szKeyName, char *szValue, int iMaxLen );
|
|
|
|
int UpdateTransmitState();
|
|
|
|
|
|
|
|
// Inputs
|
|
|
|
void InputSetAngles( inputdata_t &inputdata );
|
|
|
|
void InputEnable( inputdata_t &inputdata );
|
|
|
|
void InputDisable( inputdata_t &inputdata );
|
|
|
|
void InputSetTexture( inputdata_t &inputdata );
|
|
|
|
void InputSetEnableShadows( inputdata_t &inputdata );
|
|
|
|
void InputSetLightColor( inputdata_t &inputdata );
|
|
|
|
#ifdef MAPBASE
|
|
|
|
void InputSetBrightness( inputdata_t &inputdata );
|
|
|
|
void InputSetColorTransitionTime( inputdata_t &inputdata );
|
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 07:20:02 +03:00
|
|
|
void InputSetXOffset( inputdata_t &inputdata ) { m_flEastOffset = inputdata.value.Float(); }
|
|
|
|
void InputSetYOffset( inputdata_t &inputdata ) { m_flForwardOffset = inputdata.value.Float(); }
|
|
|
|
void InputSetOrthoSize( inputdata_t &inputdata ) { m_flOrthoSize = inputdata.value.Float(); }
|
|
|
|
void InputSetDistance( inputdata_t &inputdata ) { m_flSunDistance = inputdata.value.Float(); }
|
|
|
|
void InputSetFOV( inputdata_t &inputdata ) { m_flFOV = inputdata.value.Float(); }
|
|
|
|
void InputSetNearZDistance( inputdata_t &inputdata ) { m_flNearZ = inputdata.value.Float(); }
|
|
|
|
void InputSetNorthOffset( inputdata_t &inputdata ) { m_flNorthOffset = inputdata.value.Float(); }
|
2019-08-31 22:28:20 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
virtual int ObjectCaps( void ) { return BaseClass::ObjectCaps() & ~FCAP_ACROSS_TRANSITION; }
|
|
|
|
|
|
|
|
DECLARE_SERVERCLASS();
|
|
|
|
DECLARE_DATADESC();
|
|
|
|
|
|
|
|
private:
|
|
|
|
CNetworkVector( m_shadowDirection );
|
|
|
|
|
|
|
|
CNetworkVar( bool, m_bEnabled );
|
|
|
|
|
|
|
|
CNetworkString( m_TextureName, MAX_PATH );
|
|
|
|
#ifdef MAPBASE
|
|
|
|
CNetworkVar( int, m_nSpotlightTextureFrame );
|
|
|
|
#endif
|
|
|
|
CNetworkColor32( m_LightColor );
|
|
|
|
#ifdef MAPBASE
|
|
|
|
CNetworkVar( float, m_flBrightnessScale );
|
|
|
|
#endif
|
|
|
|
CNetworkVar( float, m_flColorTransitionTime );
|
|
|
|
CNetworkVar( float, m_flSunDistance );
|
|
|
|
CNetworkVar( float, m_flFOV );
|
|
|
|
CNetworkVar( float, m_flNearZ );
|
|
|
|
CNetworkVar( float, m_flNorthOffset );
|
|
|
|
#ifdef MAPBASE
|
|
|
|
CNetworkVar( float, m_flEastOffset ); // xoffset
|
|
|
|
CNetworkVar( float, m_flForwardOffset ); // yoffset
|
|
|
|
CNetworkVar( float, m_flOrthoSize );
|
|
|
|
#endif
|
|
|
|
CNetworkVar( bool, m_bEnableShadows );
|
|
|
|
};
|
|
|
|
|
|
|
|
LINK_ENTITY_TO_CLASS(env_global_light, CGlobalLight);
|
|
|
|
|
|
|
|
BEGIN_DATADESC( CGlobalLight )
|
|
|
|
|
|
|
|
DEFINE_KEYFIELD( m_bEnabled, FIELD_BOOLEAN, "enabled" ),
|
|
|
|
DEFINE_AUTO_ARRAY_KEYFIELD( m_TextureName, FIELD_CHARACTER, "texturename" ),
|
|
|
|
#ifdef MAPBASE
|
|
|
|
DEFINE_KEYFIELD( m_nSpotlightTextureFrame, FIELD_INTEGER, "textureframe" ),
|
|
|
|
#endif
|
|
|
|
DEFINE_KEYFIELD( m_flSunDistance, FIELD_FLOAT, "distance" ),
|
|
|
|
DEFINE_KEYFIELD( m_flFOV, FIELD_FLOAT, "fov" ),
|
|
|
|
DEFINE_KEYFIELD( m_flNearZ, FIELD_FLOAT, "nearz" ),
|
|
|
|
DEFINE_KEYFIELD( m_flNorthOffset, FIELD_FLOAT, "northoffset" ),
|
|
|
|
#ifdef MAPBASE
|
|
|
|
DEFINE_KEYFIELD( m_flEastOffset, FIELD_FLOAT, "eastoffset" ),
|
|
|
|
DEFINE_KEYFIELD( m_flForwardOffset, FIELD_FLOAT, "forwardoffset" ),
|
|
|
|
DEFINE_KEYFIELD( m_flOrthoSize, FIELD_FLOAT, "orthosize" ),
|
|
|
|
#endif
|
|
|
|
DEFINE_KEYFIELD( m_bEnableShadows, FIELD_BOOLEAN, "enableshadows" ),
|
|
|
|
DEFINE_FIELD( m_LightColor, FIELD_COLOR32 ),
|
|
|
|
#ifdef MAPBASE
|
|
|
|
DEFINE_KEYFIELD( m_flBrightnessScale, FIELD_FLOAT, "brightnessscale" ),
|
|
|
|
#endif
|
|
|
|
DEFINE_KEYFIELD( m_flColorTransitionTime, FIELD_FLOAT, "colortransitiontime" ),
|
|
|
|
|
2020-12-17 06:38:23 +03:00
|
|
|
DEFINE_FIELD( m_shadowDirection, FIELD_VECTOR ),
|
|
|
|
|
2019-08-31 22:28:20 +03:00
|
|
|
// Inputs
|
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 07:20:02 +03:00
|
|
|
#ifdef MAPBASE
|
|
|
|
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetXOffset", InputSetXOffset ),
|
|
|
|
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetYOffset", InputSetYOffset ),
|
|
|
|
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetOrthoSize", InputSetOrthoSize ),
|
|
|
|
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetDistance", InputSetDistance ),
|
|
|
|
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetFOV", InputSetFOV ),
|
|
|
|
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetNearZDistance", InputSetNearZDistance ),
|
|
|
|
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetNorthOffset", InputSetNorthOffset ),
|
|
|
|
#else
|
2019-08-31 22:28:20 +03:00
|
|
|
DEFINE_INPUT( m_flSunDistance, FIELD_FLOAT, "SetDistance" ),
|
|
|
|
DEFINE_INPUT( m_flFOV, FIELD_FLOAT, "SetFOV" ),
|
|
|
|
DEFINE_INPUT( m_flNearZ, FIELD_FLOAT, "SetNearZDistance" ),
|
|
|
|
DEFINE_INPUT( m_flNorthOffset, FIELD_FLOAT, "SetNorthOffset" ),
|
|
|
|
#endif
|
|
|
|
|
|
|
|
DEFINE_INPUTFUNC( FIELD_COLOR32, "LightColor", InputSetLightColor ),
|
|
|
|
DEFINE_INPUTFUNC( FIELD_STRING, "SetAngles", InputSetAngles ),
|
|
|
|
DEFINE_INPUTFUNC( FIELD_VOID, "Enable", InputEnable ),
|
|
|
|
DEFINE_INPUTFUNC( FIELD_VOID, "Disable", InputDisable ),
|
|
|
|
DEFINE_INPUTFUNC( FIELD_STRING, "SetTexture", InputSetTexture ),
|
|
|
|
DEFINE_INPUTFUNC( FIELD_BOOLEAN, "EnableShadows", InputSetEnableShadows ),
|
|
|
|
#ifdef MAPBASE
|
|
|
|
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetBrightness", InputSetBrightness ),
|
|
|
|
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetColorTransitionTime", InputSetColorTransitionTime ),
|
|
|
|
#endif
|
|
|
|
|
|
|
|
END_DATADESC()
|
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_SERVERCLASS_ST_NOBASE(CGlobalLight, DT_GlobalLight)
|
|
|
|
SendPropVector(SENDINFO(m_shadowDirection), -1, SPROP_NOSCALE ),
|
|
|
|
SendPropBool(SENDINFO(m_bEnabled) ),
|
|
|
|
SendPropString(SENDINFO(m_TextureName)),
|
|
|
|
#ifdef MAPBASE
|
|
|
|
SendPropInt(SENDINFO(m_nSpotlightTextureFrame)),
|
|
|
|
#endif
|
|
|
|
/*SendPropInt(SENDINFO (m_LightColor ), 32, SPROP_UNSIGNED, SendProxy_Color32ToInt32 ),*/
|
|
|
|
SendPropInt(SENDINFO (m_LightColor ), 32, SPROP_UNSIGNED, SendProxy_Color32ToInt ),
|
|
|
|
#ifdef MAPBASE
|
|
|
|
SendPropFloat( SENDINFO( m_flBrightnessScale ) ),
|
|
|
|
#endif
|
|
|
|
SendPropFloat( SENDINFO( m_flColorTransitionTime ) ),
|
|
|
|
SendPropFloat(SENDINFO(m_flSunDistance), 0, SPROP_NOSCALE ),
|
|
|
|
SendPropFloat(SENDINFO(m_flFOV), 0, SPROP_NOSCALE ),
|
|
|
|
SendPropFloat(SENDINFO(m_flNearZ), 0, SPROP_NOSCALE ),
|
|
|
|
SendPropFloat(SENDINFO(m_flNorthOffset), 0, SPROP_NOSCALE ),
|
|
|
|
#ifdef MAPBASE
|
|
|
|
SendPropFloat(SENDINFO(m_flEastOffset), 0, SPROP_NOSCALE ),
|
|
|
|
SendPropFloat(SENDINFO(m_flForwardOffset), 0, SPROP_NOSCALE ),
|
|
|
|
SendPropFloat(SENDINFO(m_flOrthoSize), 0, SPROP_NOSCALE ),
|
|
|
|
#endif
|
|
|
|
SendPropBool( SENDINFO( m_bEnableShadows ) ),
|
|
|
|
END_SEND_TABLE()
|
|
|
|
|
|
|
|
|
|
|
|
CGlobalLight::CGlobalLight()
|
|
|
|
{
|
|
|
|
#if defined( _X360 )
|
|
|
|
Q_strcpy( m_TextureName.GetForModify(), "effects/flashlight_border" );
|
|
|
|
#else
|
|
|
|
Q_strcpy( m_TextureName.GetForModify(), "effects/flashlight001" );
|
|
|
|
#endif
|
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 22:08:49 +03:00
|
|
|
#ifdef MAPBASE
|
|
|
|
m_LightColor.Init( 255, 255, 255, 255 );
|
|
|
|
#else
|
2019-08-31 22:28:20 +03:00
|
|
|
m_LightColor.Init( 255, 255, 255, 1 );
|
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 22:08:49 +03:00
|
|
|
#endif
|
2019-08-31 22:28:20 +03:00
|
|
|
m_flColorTransitionTime = 0.5f;
|
|
|
|
m_flSunDistance = 10000.0f;
|
|
|
|
m_flFOV = 5.0f;
|
|
|
|
m_bEnableShadows = false;
|
|
|
|
#ifdef MAPBASE
|
|
|
|
m_nSpotlightTextureFrame = 0;
|
|
|
|
m_flBrightnessScale = 1.0f;
|
|
|
|
m_flOrthoSize = 1000.0f;
|
|
|
|
#endif
|
2020-12-17 06:38:23 +03:00
|
|
|
m_bEnabled = true;
|
2019-08-31 22:28:20 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Purpose : Send even though we don't have a model
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
int CGlobalLight::UpdateTransmitState()
|
|
|
|
{
|
|
|
|
// ALWAYS transmit to all clients.
|
|
|
|
return SetTransmitState( FL_EDICT_ALWAYS );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CGlobalLight::KeyValue( const char *szKeyName, const char *szValue )
|
|
|
|
{
|
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 07:20:02 +03:00
|
|
|
#ifdef MAPBASE
|
|
|
|
if ( FStrEq( szKeyName, "lightcolor" ) || FStrEq( szKeyName, "color" ) )
|
|
|
|
#else
|
2019-08-31 22:28:20 +03:00
|
|
|
if ( FStrEq( szKeyName, "color" ) )
|
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 07:20:02 +03:00
|
|
|
#endif
|
2019-08-31 22:28:20 +03:00
|
|
|
{
|
|
|
|
float tmp[4];
|
|
|
|
UTIL_StringToFloatArray( tmp, 4, szValue );
|
|
|
|
|
|
|
|
m_LightColor.SetR( tmp[0] );
|
|
|
|
m_LightColor.SetG( tmp[1] );
|
|
|
|
m_LightColor.SetB( tmp[2] );
|
|
|
|
m_LightColor.SetA( tmp[3] );
|
|
|
|
}
|
|
|
|
else if ( FStrEq( szKeyName, "angles" ) )
|
|
|
|
{
|
|
|
|
QAngle angles;
|
|
|
|
UTIL_StringToVector( angles.Base(), szValue );
|
|
|
|
if (angles == vec3_angle)
|
|
|
|
{
|
|
|
|
angles.Init( 80, 30, 0 );
|
|
|
|
}
|
|
|
|
Vector vForward;
|
|
|
|
AngleVectors( angles, &vForward );
|
|
|
|
m_shadowDirection = vForward;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if ( FStrEq( szKeyName, "texturename" ) )
|
|
|
|
{
|
|
|
|
#if defined( _X360 )
|
|
|
|
if ( Q_strcmp( szValue, "effects/flashlight001" ) == 0 )
|
|
|
|
{
|
|
|
|
// Use this as the default for Xbox
|
|
|
|
Q_strcpy( m_TextureName.GetForModify(), "effects/flashlight_border" );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Q_strcpy( m_TextureName.GetForModify(), szValue );
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
Q_strcpy( m_TextureName.GetForModify(), szValue );
|
|
|
|
#endif
|
|
|
|
}
|
2020-12-17 06:38:23 +03:00
|
|
|
else if ( FStrEq( szKeyName, "StartDisabled" ) )
|
|
|
|
{
|
|
|
|
m_bEnabled.Set( atoi( szValue ) <= 0 );
|
|
|
|
}
|
2019-08-31 22:28:20 +03:00
|
|
|
|
|
|
|
return BaseClass::KeyValue( szKeyName, szValue );
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CGlobalLight::GetKeyValue( const char *szKeyName, char *szValue, int iMaxLen )
|
|
|
|
{
|
|
|
|
if ( FStrEq( szKeyName, "color" ) )
|
|
|
|
{
|
|
|
|
Q_snprintf( szValue, iMaxLen, "%d %d %d %d", m_LightColor.GetR(), m_LightColor.GetG(), m_LightColor.GetB(), m_LightColor.GetA() );
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if ( FStrEq( szKeyName, "texturename" ) )
|
|
|
|
{
|
|
|
|
Q_snprintf( szValue, iMaxLen, "%s", m_TextureName.Get() );
|
|
|
|
return true;
|
|
|
|
}
|
2020-12-17 06:38:23 +03:00
|
|
|
else if ( FStrEq( szKeyName, "StartDisabled" ) )
|
|
|
|
{
|
|
|
|
Q_snprintf( szValue, iMaxLen, "%d", !m_bEnabled.Get() );
|
|
|
|
return true;
|
|
|
|
}
|
2019-08-31 22:28:20 +03:00
|
|
|
return BaseClass::GetKeyValue( szKeyName, szValue, iMaxLen );
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Purpose :
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void CGlobalLight::Spawn( void )
|
|
|
|
{
|
|
|
|
Precache();
|
|
|
|
SetSolid( SOLID_NONE );
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Input values
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void CGlobalLight::InputSetAngles( inputdata_t &inputdata )
|
|
|
|
{
|
|
|
|
const char *pAngles = inputdata.value.String();
|
|
|
|
|
|
|
|
QAngle angles;
|
|
|
|
UTIL_StringToVector( angles.Base(), pAngles );
|
|
|
|
|
|
|
|
Vector vTemp;
|
|
|
|
AngleVectors( angles, &vTemp );
|
|
|
|
m_shadowDirection = vTemp;
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Purpose : Input handlers
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void CGlobalLight::InputEnable( inputdata_t &inputdata )
|
|
|
|
{
|
|
|
|
m_bEnabled = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CGlobalLight::InputDisable( inputdata_t &inputdata )
|
|
|
|
{
|
|
|
|
m_bEnabled = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CGlobalLight::InputSetTexture( inputdata_t &inputdata )
|
|
|
|
{
|
|
|
|
Q_strcpy( m_TextureName.GetForModify(), inputdata.value.String() );
|
|
|
|
}
|
|
|
|
|
|
|
|
void CGlobalLight::InputSetEnableShadows( inputdata_t &inputdata )
|
|
|
|
{
|
|
|
|
m_bEnableShadows = inputdata.value.Bool();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CGlobalLight::InputSetLightColor( inputdata_t &inputdata )
|
|
|
|
{
|
|
|
|
m_LightColor = inputdata.value.Color32();
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MAPBASE
|
|
|
|
void CGlobalLight::InputSetBrightness( inputdata_t &inputdata )
|
|
|
|
{
|
|
|
|
m_flBrightnessScale = inputdata.value.Float();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CGlobalLight::InputSetColorTransitionTime( inputdata_t &inputdata )
|
|
|
|
{
|
|
|
|
m_flColorTransitionTime = inputdata.value.Float();
|
|
|
|
}
|
|
|
|
#endif
|