455 lines
15 KiB
C
Raw Normal View History

2013-12-02 19:31:46 -08:00
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Player for HL2.
//
// $NoKeywords: $
//=============================================================================//
#ifndef HL2_PLAYER_H
#define HL2_PLAYER_H
#pragma once
#include "player.h"
#include "hl2_playerlocaldata.h"
#include "simtimer.h"
#include "soundenvelope.h"
Mapbase v4.3 - Fixed a crash with multiple trigger_look targets - Fixed an issue where some zombie submodel server ragdolls are not solid to the world - Fixed a crash with certain instance classes being loaded in a savegame before the class is registered - Added some of Tony Sergi's missing Source 2007 fixes (contributed by Kris) - Added "ClientCommand" hook for VScript to allow handling of unknown console commands - Added "PlayerRunCommand" hook for VScript to control player movement - Added new button-related script functions for players (GetButtons, DisableButtons, etc.) - Added CUserCmd accessor in VScript for the "PlayerRunCommand" hook - Added "GetWaterLevel" function for VScript - Exposed "Ignite" to VScript for controlling how a fire starts - Fixed NPCs being unable to unholster weapons - Fixed Mapbase crashing when Steam isn't running - Fixed issues with angled/updating sky_camera save/restore - Added VBSP "-skyboxcubemap" parameter to enable skybox default cubemaps + "-defaultcubemapres" to control their resolution - Added ability to disable VScript in a map (and fixed a few potential complications from disabling VScript) - Made clientside VScript only initialize after world is spawned in order to receive serverside script language in time - Added tons of VScript functions to CBaseAnimating related to bodygroups, sequences, etc. - Added VScript functions to players for getting user ID and player name, similar to logic_playerinfo - Added a few L4D2 script functions missing from the ASW SDK - Added "Localize" singleton with a single "GetTokenAsUTF8" function for getting localization strings - Disabled r_hunkalloclightmaps by the request of various users (apparently this completely removes the "Engine hunk overflow" error and allows for really high-res lightmaps) - Fixed npc_antlionguard NPC_TranslateActivity not hooking into base class (allows for VScript manipulation) - Added various unused antlion guard activities to npc_antlionguard AI, allowing for usage as registered activities - Added keyvalue to set LOS mask on combine_mine - Added +USE bounding box limiter to prop_interactable
2020-07-16 15:43:30 +00:00
// In HL2MP we need to inherit from BaseMultiplayerPlayer!
#if defined ( HL2MP )
#include "basemultiplayerplayer.h"
#endif
2013-12-02 19:31:46 -08:00
class CAI_Squad;
class CPropCombineBall;
extern int TrainSpeed(int iSpeed, int iMax);
extern void CopyToBodyQue( CBaseAnimating *pCorpse );
#define ARMOR_DECAY_TIME 3.5f
enum HL2PlayerPhysFlag_e
{
// 1 -- 5 are used by enum PlayerPhysFlag_e in player.h
PFLAG_ONBARNACLE = ( 1<<6 ) // player is hangning from the barnalce
};
class IPhysicsPlayerController;
class CLogicPlayerProxy;
struct commandgoal_t
{
Vector m_vecGoalLocation;
CBaseEntity *m_pGoalEntity;
};
// Time between checks to determine whether NPCs are illuminated by the flashlight
#define FLASHLIGHT_NPC_CHECK_INTERVAL 0.4
//----------------------------------------------------
// Definitions for weapon slots
//----------------------------------------------------
#define WEAPON_MELEE_SLOT 0
#define WEAPON_SECONDARY_SLOT 1
#define WEAPON_PRIMARY_SLOT 2
#define WEAPON_EXPLOSIVE_SLOT 3
#define WEAPON_TOOL_SLOT 4
//=============================================================================
//=============================================================================
class CSuitPowerDevice
{
public:
CSuitPowerDevice( int bitsID, float flDrainRate ) { m_bitsDeviceID = bitsID; m_flDrainRate = flDrainRate; }
private:
int m_bitsDeviceID; // tells what the device is. DEVICE_SPRINT, DEVICE_FLASHLIGHT, etc. BITMASK!!!!!
float m_flDrainRate; // how quickly does this device deplete suit power? ( percent per second )
public:
int GetDeviceID( void ) const { return m_bitsDeviceID; }
float GetDeviceDrainRate( void ) const
{
if( g_pGameRules->GetSkillLevel() == SKILL_EASY && hl2_episodic.GetBool() && !(GetDeviceID()&bits_SUIT_DEVICE_SPRINT) )
return m_flDrainRate * 0.5f;
else
return m_flDrainRate;
}
Mapbase v5.0 - Added keyvalue to hl2_gamerules which allows respawning in singleplayer - Added the game instructor system (including env_instructor_hint) from later Valve games using a VDC tutorial which adjusts the version from the Alien Swarm SDK to FPS rules and a Source 2013 environment; Also added new KV and icons for further control from mappers (tutorial mentioned by Maestra Fenix) - Added L4D/TF2 glows + point_glow entity as an all-purpose SDK-based off-shoot of tf_glow - Fixed weapon pickup sound not playing (reported by Sl0th and later Cvoxulary) - Fixed env_projectedtextures not updating on save/load - Added func_fake_worldportal, a spatial point_camera inspired by linked_portal_door based on SDK code alone (WIP, may be changed a lot in future updates) - Added option for point_camera and func_reflective_glass to use different render targets, therefore allowing multiple cameras and mirrors to be active at the same time - Added additional RT camera textures to choose from with a default of 3, but also controllable through a -numcameratextures command line param - Added adjustable convars for main view NearZ and skybox NearZ (suggested by someone recently, also suggested by Klems over a year ago) - Fixed map-specific localization files, cleaned up map-specific file code - Added a new block to gameinfo.txt which allows mods to automatically append their own command line parameters - Fixed math_lightpattern corruption when setting pattern/style while active - Fixed the "Touch" input crashing when given no entity - Added a way to add EFlags via keyvalue (suggested by Niker107) - Fixed ai_script_conditions not working without a NPC actor (reported by MetroHam) - Fixed point_radiation_source causing huge problems when intensity is 0, even though it was already advised against (reported by beefbacon) - Added "Mapbase" header to Mapbase-specific code files - Fixed an issue with updating sky_camera not obtaining area correctly, causing some entities to not draw in the skybox - Added "CopyFogController" and "CopyFogControllerWithScale" inputs to sky_camera, which copy fog parameters directly from a fog controller - Added "SetScale" input to sky_camera for live scale changing - Added convar to control player crouch speed multiplier (suggested by ArtyIF) - Added a ton of fixes for people running the Debug configuration of the codebase (partial credit to stepa2) - Added support for pre-defined enums and constants in VScript, starting with various values from the SDK code (damage types, trace masks, etc.) - Added limited support for Valve's Quaternion class in VScript - Added new instance helper capabilities, destructible game instances, and other misc. changes to VScript library - Replaced most of the VScript "accessor" classes with direct references to the original classes, as they were getting complicated fast and adding new VScript-only functions to the original classes might not be as bad as previously thought - Added base NPC hooks for AI sensing in VScript (allows control over sight and hearing), also exposed CSound for it - Added various functions and hooks for VPhysics integration in VScript - Added VScript-based custom suit devices - Expanded trace info exposed to VScript to allow plane and surface access (suggested by krassell) - Added ability to insert localization strings through VScript - Added various misc. VScript functions with various purposes, including reading/writing EFlags, movetypes, collision groups, etc. - Fixed VBSP not being able to correctly parse parallax corrected cubemaps in maps with instances
2020-08-14 21:21:25 +00:00
#ifdef MAPBASE
void SetDeviceDrainRate( float flDrainRate ) { m_flDrainRate = flDrainRate; }
#endif
2013-12-02 19:31:46 -08:00
};
//=============================================================================
// >> HL2_PLAYER
//=============================================================================
Mapbase v4.3 - Fixed a crash with multiple trigger_look targets - Fixed an issue where some zombie submodel server ragdolls are not solid to the world - Fixed a crash with certain instance classes being loaded in a savegame before the class is registered - Added some of Tony Sergi's missing Source 2007 fixes (contributed by Kris) - Added "ClientCommand" hook for VScript to allow handling of unknown console commands - Added "PlayerRunCommand" hook for VScript to control player movement - Added new button-related script functions for players (GetButtons, DisableButtons, etc.) - Added CUserCmd accessor in VScript for the "PlayerRunCommand" hook - Added "GetWaterLevel" function for VScript - Exposed "Ignite" to VScript for controlling how a fire starts - Fixed NPCs being unable to unholster weapons - Fixed Mapbase crashing when Steam isn't running - Fixed issues with angled/updating sky_camera save/restore - Added VBSP "-skyboxcubemap" parameter to enable skybox default cubemaps + "-defaultcubemapres" to control their resolution - Added ability to disable VScript in a map (and fixed a few potential complications from disabling VScript) - Made clientside VScript only initialize after world is spawned in order to receive serverside script language in time - Added tons of VScript functions to CBaseAnimating related to bodygroups, sequences, etc. - Added VScript functions to players for getting user ID and player name, similar to logic_playerinfo - Added a few L4D2 script functions missing from the ASW SDK - Added "Localize" singleton with a single "GetTokenAsUTF8" function for getting localization strings - Disabled r_hunkalloclightmaps by the request of various users (apparently this completely removes the "Engine hunk overflow" error and allows for really high-res lightmaps) - Fixed npc_antlionguard NPC_TranslateActivity not hooking into base class (allows for VScript manipulation) - Added various unused antlion guard activities to npc_antlionguard AI, allowing for usage as registered activities - Added keyvalue to set LOS mask on combine_mine - Added +USE bounding box limiter to prop_interactable
2020-07-16 15:43:30 +00:00
#if defined ( HL2MP )
class CHL2_Player : public CBaseMultiplayerPlayer
#else
2013-12-02 19:31:46 -08:00
class CHL2_Player : public CBasePlayer
Mapbase v4.3 - Fixed a crash with multiple trigger_look targets - Fixed an issue where some zombie submodel server ragdolls are not solid to the world - Fixed a crash with certain instance classes being loaded in a savegame before the class is registered - Added some of Tony Sergi's missing Source 2007 fixes (contributed by Kris) - Added "ClientCommand" hook for VScript to allow handling of unknown console commands - Added "PlayerRunCommand" hook for VScript to control player movement - Added new button-related script functions for players (GetButtons, DisableButtons, etc.) - Added CUserCmd accessor in VScript for the "PlayerRunCommand" hook - Added "GetWaterLevel" function for VScript - Exposed "Ignite" to VScript for controlling how a fire starts - Fixed NPCs being unable to unholster weapons - Fixed Mapbase crashing when Steam isn't running - Fixed issues with angled/updating sky_camera save/restore - Added VBSP "-skyboxcubemap" parameter to enable skybox default cubemaps + "-defaultcubemapres" to control their resolution - Added ability to disable VScript in a map (and fixed a few potential complications from disabling VScript) - Made clientside VScript only initialize after world is spawned in order to receive serverside script language in time - Added tons of VScript functions to CBaseAnimating related to bodygroups, sequences, etc. - Added VScript functions to players for getting user ID and player name, similar to logic_playerinfo - Added a few L4D2 script functions missing from the ASW SDK - Added "Localize" singleton with a single "GetTokenAsUTF8" function for getting localization strings - Disabled r_hunkalloclightmaps by the request of various users (apparently this completely removes the "Engine hunk overflow" error and allows for really high-res lightmaps) - Fixed npc_antlionguard NPC_TranslateActivity not hooking into base class (allows for VScript manipulation) - Added various unused antlion guard activities to npc_antlionguard AI, allowing for usage as registered activities - Added keyvalue to set LOS mask on combine_mine - Added +USE bounding box limiter to prop_interactable
2020-07-16 15:43:30 +00:00
#endif
2013-12-02 19:31:46 -08:00
{
public:
Mapbase v4.3 - Fixed a crash with multiple trigger_look targets - Fixed an issue where some zombie submodel server ragdolls are not solid to the world - Fixed a crash with certain instance classes being loaded in a savegame before the class is registered - Added some of Tony Sergi's missing Source 2007 fixes (contributed by Kris) - Added "ClientCommand" hook for VScript to allow handling of unknown console commands - Added "PlayerRunCommand" hook for VScript to control player movement - Added new button-related script functions for players (GetButtons, DisableButtons, etc.) - Added CUserCmd accessor in VScript for the "PlayerRunCommand" hook - Added "GetWaterLevel" function for VScript - Exposed "Ignite" to VScript for controlling how a fire starts - Fixed NPCs being unable to unholster weapons - Fixed Mapbase crashing when Steam isn't running - Fixed issues with angled/updating sky_camera save/restore - Added VBSP "-skyboxcubemap" parameter to enable skybox default cubemaps + "-defaultcubemapres" to control their resolution - Added ability to disable VScript in a map (and fixed a few potential complications from disabling VScript) - Made clientside VScript only initialize after world is spawned in order to receive serverside script language in time - Added tons of VScript functions to CBaseAnimating related to bodygroups, sequences, etc. - Added VScript functions to players for getting user ID and player name, similar to logic_playerinfo - Added a few L4D2 script functions missing from the ASW SDK - Added "Localize" singleton with a single "GetTokenAsUTF8" function for getting localization strings - Disabled r_hunkalloclightmaps by the request of various users (apparently this completely removes the "Engine hunk overflow" error and allows for really high-res lightmaps) - Fixed npc_antlionguard NPC_TranslateActivity not hooking into base class (allows for VScript manipulation) - Added various unused antlion guard activities to npc_antlionguard AI, allowing for usage as registered activities - Added keyvalue to set LOS mask on combine_mine - Added +USE bounding box limiter to prop_interactable
2020-07-16 15:43:30 +00:00
#if defined ( HL2MP )
DECLARE_CLASS( CHL2_Player, CBaseMultiplayerPlayer );
#else
2013-12-02 19:31:46 -08:00
DECLARE_CLASS( CHL2_Player, CBasePlayer );
Mapbase v4.3 - Fixed a crash with multiple trigger_look targets - Fixed an issue where some zombie submodel server ragdolls are not solid to the world - Fixed a crash with certain instance classes being loaded in a savegame before the class is registered - Added some of Tony Sergi's missing Source 2007 fixes (contributed by Kris) - Added "ClientCommand" hook for VScript to allow handling of unknown console commands - Added "PlayerRunCommand" hook for VScript to control player movement - Added new button-related script functions for players (GetButtons, DisableButtons, etc.) - Added CUserCmd accessor in VScript for the "PlayerRunCommand" hook - Added "GetWaterLevel" function for VScript - Exposed "Ignite" to VScript for controlling how a fire starts - Fixed NPCs being unable to unholster weapons - Fixed Mapbase crashing when Steam isn't running - Fixed issues with angled/updating sky_camera save/restore - Added VBSP "-skyboxcubemap" parameter to enable skybox default cubemaps + "-defaultcubemapres" to control their resolution - Added ability to disable VScript in a map (and fixed a few potential complications from disabling VScript) - Made clientside VScript only initialize after world is spawned in order to receive serverside script language in time - Added tons of VScript functions to CBaseAnimating related to bodygroups, sequences, etc. - Added VScript functions to players for getting user ID and player name, similar to logic_playerinfo - Added a few L4D2 script functions missing from the ASW SDK - Added "Localize" singleton with a single "GetTokenAsUTF8" function for getting localization strings - Disabled r_hunkalloclightmaps by the request of various users (apparently this completely removes the "Engine hunk overflow" error and allows for really high-res lightmaps) - Fixed npc_antlionguard NPC_TranslateActivity not hooking into base class (allows for VScript manipulation) - Added various unused antlion guard activities to npc_antlionguard AI, allowing for usage as registered activities - Added keyvalue to set LOS mask on combine_mine - Added +USE bounding box limiter to prop_interactable
2020-07-16 15:43:30 +00:00
#endif
#ifdef MAPBASE_VSCRIPT
DECLARE_ENT_SCRIPTDESC();
#endif
2013-12-02 19:31:46 -08:00
CHL2_Player();
~CHL2_Player( void );
static CHL2_Player *CreatePlayer( const char *className, edict_t *ed )
{
CHL2_Player::s_PlayerEdict = ed;
return (CHL2_Player*)CreateEntityByName( className );
}
DECLARE_SERVERCLASS();
DECLARE_DATADESC();
virtual void CreateCorpse( void ) { CopyToBodyQue( this ); };
virtual void Precache( void );
virtual void Spawn(void);
virtual void Activate( void );
virtual void CheatImpulseCommands( int iImpulse );
virtual void PlayerRunCommand( CUserCmd *ucmd, IMoveHelper *moveHelper);
virtual void PlayerUse ( void );
virtual void SuspendUse( float flDuration ) { m_flTimeUseSuspended = gpGlobals->curtime + flDuration; }
virtual void UpdateClientData( void );
virtual void OnRestore();
virtual void StopLoopingSounds( void );
virtual void Splash( void );
virtual void ModifyOrAppendPlayerCriteria( AI_CriteriaSet& set );
#ifdef MAPBASE
Mapbase v5.0 - Added keyvalue to hl2_gamerules which allows respawning in singleplayer - Added the game instructor system (including env_instructor_hint) from later Valve games using a VDC tutorial which adjusts the version from the Alien Swarm SDK to FPS rules and a Source 2013 environment; Also added new KV and icons for further control from mappers (tutorial mentioned by Maestra Fenix) - Added L4D/TF2 glows + point_glow entity as an all-purpose SDK-based off-shoot of tf_glow - Fixed weapon pickup sound not playing (reported by Sl0th and later Cvoxulary) - Fixed env_projectedtextures not updating on save/load - Added func_fake_worldportal, a spatial point_camera inspired by linked_portal_door based on SDK code alone (WIP, may be changed a lot in future updates) - Added option for point_camera and func_reflective_glass to use different render targets, therefore allowing multiple cameras and mirrors to be active at the same time - Added additional RT camera textures to choose from with a default of 3, but also controllable through a -numcameratextures command line param - Added adjustable convars for main view NearZ and skybox NearZ (suggested by someone recently, also suggested by Klems over a year ago) - Fixed map-specific localization files, cleaned up map-specific file code - Added a new block to gameinfo.txt which allows mods to automatically append their own command line parameters - Fixed math_lightpattern corruption when setting pattern/style while active - Fixed the "Touch" input crashing when given no entity - Added a way to add EFlags via keyvalue (suggested by Niker107) - Fixed ai_script_conditions not working without a NPC actor (reported by MetroHam) - Fixed point_radiation_source causing huge problems when intensity is 0, even though it was already advised against (reported by beefbacon) - Added "Mapbase" header to Mapbase-specific code files - Fixed an issue with updating sky_camera not obtaining area correctly, causing some entities to not draw in the skybox - Added "CopyFogController" and "CopyFogControllerWithScale" inputs to sky_camera, which copy fog parameters directly from a fog controller - Added "SetScale" input to sky_camera for live scale changing - Added convar to control player crouch speed multiplier (suggested by ArtyIF) - Added a ton of fixes for people running the Debug configuration of the codebase (partial credit to stepa2) - Added support for pre-defined enums and constants in VScript, starting with various values from the SDK code (damage types, trace masks, etc.) - Added limited support for Valve's Quaternion class in VScript - Added new instance helper capabilities, destructible game instances, and other misc. changes to VScript library - Replaced most of the VScript "accessor" classes with direct references to the original classes, as they were getting complicated fast and adding new VScript-only functions to the original classes might not be as bad as previously thought - Added base NPC hooks for AI sensing in VScript (allows control over sight and hearing), also exposed CSound for it - Added various functions and hooks for VPhysics integration in VScript - Added VScript-based custom suit devices - Expanded trace info exposed to VScript to allow plane and surface access (suggested by krassell) - Added ability to insert localization strings through VScript - Added various misc. VScript functions with various purposes, including reading/writing EFlags, movetypes, collision groups, etc. - Fixed VBSP not being able to correctly parse parallax corrected cubemaps in maps with instances
2020-08-14 21:21:25 +00:00
// For the logic_playerproxy output
void SpawnedAtPoint( CBaseEntity *pSpawnPoint );
void ResetAnimation( void );
void SetAnimation( PLAYER_ANIM playerAnim );
virtual const char *GetOverrideStepSound( const char *pszBaseStepSoundName );
#endif
2013-12-02 19:31:46 -08:00
void DrawDebugGeometryOverlays(void);
virtual Vector EyeDirection2D( void );
virtual Vector EyeDirection3D( void );
virtual void CommanderMode();
virtual bool ClientCommand( const CCommand &args );
// from cbasecombatcharacter
void InitVCollision( const Vector &vecAbsOrigin, const Vector &vecAbsVelocity );
WeaponProficiency_t CalcWeaponProficiency( CBaseCombatWeapon *pWeapon );
Class_T Classify ( void );
// from CBasePlayer
virtual void SetupVisibility( CBaseEntity *pViewEntity, unsigned char *pvs, int pvssize );
// Suit Power Interface
void SuitPower_Update( void );
bool SuitPower_Drain( float flPower ); // consume some of the suit's power.
void SuitPower_Charge( float flPower ); // add suit power.
void SuitPower_SetCharge( float flPower ) { m_HL2Local.m_flSuitPower = flPower; }
void SuitPower_Initialize( void );
bool SuitPower_IsDeviceActive( const CSuitPowerDevice &device );
bool SuitPower_AddDevice( const CSuitPowerDevice &device );
bool SuitPower_RemoveDevice( const CSuitPowerDevice &device );
bool SuitPower_ShouldRecharge( void );
float SuitPower_GetCurrentPercentage( void ) { return m_HL2Local.m_flSuitPower; }
void SetFlashlightEnabled( bool bState );
#ifdef MAPBASE
// Needed for logic_playerproxy
float GetFlashlightBattery();
#endif
2013-12-02 19:31:46 -08:00
// Apply a battery
bool ApplyBattery( float powerMultiplier = 1.0 );
// Commander Mode for controller NPCs
enum CommanderCommand_t
{
CC_NONE,
CC_TOGGLE,
CC_FOLLOW,
CC_SEND,
};
void CommanderUpdate();
void CommanderExecute( CommanderCommand_t command = CC_TOGGLE );
bool CommanderFindGoal( commandgoal_t *pGoal );
void NotifyFriendsOfDamage( CBaseEntity *pAttackerEntity );
CAI_BaseNPC *GetSquadCommandRepresentative();
int GetNumSquadCommandables();
int GetNumSquadCommandableMedics();
#ifdef MAPBASE
void InputSquadForceSummon( inputdata_t &inputdata );
void InputSquadForceGoTo( inputdata_t &inputdata );
void InputEnableGeigerCounter( inputdata_t &inputdata );
void InputDisableGeigerCounter( inputdata_t &inputdata );
void InputShowSquadHUD( inputdata_t &inputdata );
void InputHideSquadHUD( inputdata_t &inputdata );
#endif
2013-12-02 19:31:46 -08:00
// Locator
void UpdateLocatorPosition( const Vector &vecPosition );
// Sprint Device
void StartAutoSprint( void );
void StartSprinting( void );
void StopSprinting( void );
void InitSprinting( void );
bool IsSprinting( void ) { return m_fIsSprinting; }
bool CanSprint( void );
void EnableSprint( bool bEnable);
bool CanZoom( CBaseEntity *pRequester );
void ToggleZoom(void);
void StartZooming( void );
void StopZooming( void );
bool IsZooming( void );
void CheckSuitZoom( void );
// Walking
void StartWalking( void );
void StopWalking( void );
bool IsWalking( void ) { return m_fIsWalking; }
// Aiming heuristics accessors
virtual float GetIdleTime( void ) const { return ( m_flIdleTime - m_flMoveTime ); }
virtual float GetMoveTime( void ) const { return ( m_flMoveTime - m_flIdleTime ); }
virtual float GetLastDamageTime( void ) const { return m_flLastDamageTime; }
virtual bool IsDucking( void ) const { return !!( GetFlags() & FL_DUCKING ); }
virtual bool PassesDamageFilter( const CTakeDamageInfo &info );
void InputIgnoreFallDamage( inputdata_t &inputdata );
void InputIgnoreFallDamageWithoutReset( inputdata_t &inputdata );
void InputEnableFlashlight( inputdata_t &inputdata );
void InputDisableFlashlight( inputdata_t &inputdata );
#ifdef MAPBASE
void InputAddArmor( inputdata_t &inputdata );
void InputRemoveArmor( inputdata_t &inputdata );
void InputSetArmor( inputdata_t &inputdata );
void InputAddAuxPower( inputdata_t &inputdata );
void InputRemoveAuxPower( inputdata_t &inputdata );
void InputSetAuxPower( inputdata_t &inputdata );
void InputTurnFlashlightOn( inputdata_t &inputdata );
void InputTurnFlashlightOff( inputdata_t &inputdata );
#endif
2013-12-02 19:31:46 -08:00
const impactdamagetable_t &GetPhysicsImpactDamageTable();
virtual int OnTakeDamage( const CTakeDamageInfo &info );
virtual int OnTakeDamage_Alive( const CTakeDamageInfo &info );
virtual void OnDamagedByExplosion( const CTakeDamageInfo &info );
bool ShouldShootMissTarget( CBaseCombatCharacter *pAttacker );
void CombineBallSocketed( CPropCombineBall *pCombineBall );
virtual void Event_KilledOther( CBaseEntity *pVictim, const CTakeDamageInfo &info );
virtual void GetAutoaimVector( autoaim_params_t &params );
bool ShouldKeepLockedAutoaimTarget( EHANDLE hLockedTarget );
void SetLocatorTargetEntity( CBaseEntity *pEntity ) { m_hLocatorTargetEntity.Set( pEntity ); }
Mapbase v6.0 - 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
2020-11-26 02:26:55 +00:00
#ifdef MAPBASE
virtual bool CanAutoSwitchToNextBestWeapon( CBaseCombatWeapon *pWeapon );
#endif
2013-12-02 19:31:46 -08:00
virtual int GiveAmmo( int nCount, int nAmmoIndex, bool bSuppressSound);
virtual bool BumpWeapon( CBaseCombatWeapon *pWeapon );
virtual bool Weapon_CanUse( CBaseCombatWeapon *pWeapon );
virtual void Weapon_Equip( CBaseCombatWeapon *pWeapon );
virtual bool Weapon_Lower( void );
virtual bool Weapon_Ready( void );
virtual bool Weapon_Switch( CBaseCombatWeapon *pWeapon, int viewmodelindex = 0 );
virtual bool Weapon_CanSwitchTo( CBaseCombatWeapon *pWeapon );
void FirePlayerProxyOutput( const char *pszOutputName, variant_t variant, CBaseEntity *pActivator, CBaseEntity *pCaller );
CLogicPlayerProxy *GetPlayerProxy( void );
// Flashlight Device
void CheckFlashlight( void );
int FlashlightIsOn( void );
void FlashlightTurnOn( void );
void FlashlightTurnOff( void );
bool IsIlluminatedByFlashlight( CBaseEntity *pEntity, float *flReturnDot );
void SetFlashlightPowerDrainScale( float flScale ) { m_flFlashlightPowerDrainScale = flScale; }
// Underwater breather device
virtual void SetPlayerUnderwater( bool state );
virtual bool CanBreatheUnderwater() const { return m_HL2Local.m_flSuitPower > 0.0f; }
// physics interactions
virtual void PickupObject( CBaseEntity *pObject, bool bLimitMassAndSize );
virtual bool IsHoldingEntity( CBaseEntity *pEnt );
virtual void ForceDropOfCarriedPhysObjects( CBaseEntity *pOnlyIfHoldindThis );
virtual float GetHeldObjectMass( IPhysicsObject *pHeldObject );
Mapbase v4.3 - Fixed a crash with multiple trigger_look targets - Fixed an issue where some zombie submodel server ragdolls are not solid to the world - Fixed a crash with certain instance classes being loaded in a savegame before the class is registered - Added some of Tony Sergi's missing Source 2007 fixes (contributed by Kris) - Added "ClientCommand" hook for VScript to allow handling of unknown console commands - Added "PlayerRunCommand" hook for VScript to control player movement - Added new button-related script functions for players (GetButtons, DisableButtons, etc.) - Added CUserCmd accessor in VScript for the "PlayerRunCommand" hook - Added "GetWaterLevel" function for VScript - Exposed "Ignite" to VScript for controlling how a fire starts - Fixed NPCs being unable to unholster weapons - Fixed Mapbase crashing when Steam isn't running - Fixed issues with angled/updating sky_camera save/restore - Added VBSP "-skyboxcubemap" parameter to enable skybox default cubemaps + "-defaultcubemapres" to control their resolution - Added ability to disable VScript in a map (and fixed a few potential complications from disabling VScript) - Made clientside VScript only initialize after world is spawned in order to receive serverside script language in time - Added tons of VScript functions to CBaseAnimating related to bodygroups, sequences, etc. - Added VScript functions to players for getting user ID and player name, similar to logic_playerinfo - Added a few L4D2 script functions missing from the ASW SDK - Added "Localize" singleton with a single "GetTokenAsUTF8" function for getting localization strings - Disabled r_hunkalloclightmaps by the request of various users (apparently this completely removes the "Engine hunk overflow" error and allows for really high-res lightmaps) - Fixed npc_antlionguard NPC_TranslateActivity not hooking into base class (allows for VScript manipulation) - Added various unused antlion guard activities to npc_antlionguard AI, allowing for usage as registered activities - Added keyvalue to set LOS mask on combine_mine - Added +USE bounding box limiter to prop_interactable
2020-07-16 15:43:30 +00:00
virtual CBaseEntity *CHL2_Player::GetHeldObject( void );
2013-12-02 19:31:46 -08:00
virtual bool IsFollowingPhysics( void ) { return (m_afPhysicsFlags & PFLAG_ONBARNACLE) > 0; }
void InputForceDropPhysObjects( inputdata_t &data );
virtual void Event_Killed( const CTakeDamageInfo &info );
void NotifyScriptsOfDeath( void );
// override the test for getting hit
virtual bool TestHitboxes( const Ray_t &ray, unsigned int fContentsMask, trace_t& tr );
LadderMove_t *GetLadderMove() { return &m_HL2Local.m_LadderMove; }
virtual void ExitLadder();
virtual surfacedata_t *GetLadderSurface( const Vector &origin );
virtual void EquipSuit( bool bPlayEffects = true );
virtual void RemoveSuit( void );
void HandleAdmireGlovesAnimation( void );
void StartAdmireGlovesAnimation( void );
void HandleSpeedChanges( void );
void SetControlClass( Class_T controlClass ) { m_nControlClass = controlClass; }
void StartWaterDeathSounds( void );
void StopWaterDeathSounds( void );
bool IsWeaponLowered( void ) { return m_HL2Local.m_bWeaponLowered; }
void HandleArmorReduction( void );
void StartArmorReduction( void ) { m_flArmorReductionTime = gpGlobals->curtime + ARMOR_DECAY_TIME;
m_iArmorReductionFrom = ArmorValue();
}
void MissedAR2AltFire();
inline void EnableCappedPhysicsDamage();
inline void DisableCappedPhysicsDamage();
// HUD HINTS
void DisplayLadderHudHint();
Mapbase v5.0 - Added keyvalue to hl2_gamerules which allows respawning in singleplayer - Added the game instructor system (including env_instructor_hint) from later Valve games using a VDC tutorial which adjusts the version from the Alien Swarm SDK to FPS rules and a Source 2013 environment; Also added new KV and icons for further control from mappers (tutorial mentioned by Maestra Fenix) - Added L4D/TF2 glows + point_glow entity as an all-purpose SDK-based off-shoot of tf_glow - Fixed weapon pickup sound not playing (reported by Sl0th and later Cvoxulary) - Fixed env_projectedtextures not updating on save/load - Added func_fake_worldportal, a spatial point_camera inspired by linked_portal_door based on SDK code alone (WIP, may be changed a lot in future updates) - Added option for point_camera and func_reflective_glass to use different render targets, therefore allowing multiple cameras and mirrors to be active at the same time - Added additional RT camera textures to choose from with a default of 3, but also controllable through a -numcameratextures command line param - Added adjustable convars for main view NearZ and skybox NearZ (suggested by someone recently, also suggested by Klems over a year ago) - Fixed map-specific localization files, cleaned up map-specific file code - Added a new block to gameinfo.txt which allows mods to automatically append their own command line parameters - Fixed math_lightpattern corruption when setting pattern/style while active - Fixed the "Touch" input crashing when given no entity - Added a way to add EFlags via keyvalue (suggested by Niker107) - Fixed ai_script_conditions not working without a NPC actor (reported by MetroHam) - Fixed point_radiation_source causing huge problems when intensity is 0, even though it was already advised against (reported by beefbacon) - Added "Mapbase" header to Mapbase-specific code files - Fixed an issue with updating sky_camera not obtaining area correctly, causing some entities to not draw in the skybox - Added "CopyFogController" and "CopyFogControllerWithScale" inputs to sky_camera, which copy fog parameters directly from a fog controller - Added "SetScale" input to sky_camera for live scale changing - Added convar to control player crouch speed multiplier (suggested by ArtyIF) - Added a ton of fixes for people running the Debug configuration of the codebase (partial credit to stepa2) - Added support for pre-defined enums and constants in VScript, starting with various values from the SDK code (damage types, trace masks, etc.) - Added limited support for Valve's Quaternion class in VScript - Added new instance helper capabilities, destructible game instances, and other misc. changes to VScript library - Replaced most of the VScript "accessor" classes with direct references to the original classes, as they were getting complicated fast and adding new VScript-only functions to the original classes might not be as bad as previously thought - Added base NPC hooks for AI sensing in VScript (allows control over sight and hearing), also exposed CSound for it - Added various functions and hooks for VPhysics integration in VScript - Added VScript-based custom suit devices - Expanded trace info exposed to VScript to allow plane and surface access (suggested by krassell) - Added ability to insert localization strings through VScript - Added various misc. VScript functions with various purposes, including reading/writing EFlags, movetypes, collision groups, etc. - Fixed VBSP not being able to correctly parse parallax corrected cubemaps in maps with instances
2020-08-14 21:21:25 +00:00
#ifdef MAPBASE
void InitCustomSuitDevice( int iDeviceID, float flDrainRate );
void AddCustomSuitDevice( int iDeviceID );
void RemoveCustomSuitDevice( int iDeviceID );
bool IsCustomSuitDeviceActive( int iDeviceID );
#endif
2013-12-02 19:31:46 -08:00
CSoundPatch *m_sndLeeches;
CSoundPatch *m_sndWaterSplashes;
protected:
virtual void PreThink( void );
virtual void PostThink( void );
virtual bool HandleInteraction(int interactionType, void *data, CBaseCombatCharacter* sourceEnt);
virtual void UpdateWeaponPosture( void );
virtual void ItemPostFrame();
virtual void PlayUseDenySound();
private:
bool CommanderExecuteOne( CAI_BaseNPC *pNpc, const commandgoal_t &goal, CAI_BaseNPC **Allies, int numAllies );
void OnSquadMemberKilled( inputdata_t &data );
Class_T m_nControlClass; // Class when player is controlling another entity
// This player's HL2 specific data that should only be replicated to
// the player and not to other players.
CNetworkVarEmbedded( CHL2PlayerLocalData, m_HL2Local );
float m_flTimeAllSuitDevicesOff;
bool m_bSprintEnabled; // Used to disable sprint temporarily
bool m_bIsAutoSprinting; // A proxy for holding down the sprint key.
float m_fAutoSprintMinTime; // Minimum time to maintain autosprint regardless of player speed.
CNetworkVar( bool, m_fIsSprinting );
CNetworkVarForDerived( bool, m_fIsWalking );
protected: // Jeep: Portal_Player needs access to this variable to overload PlayerUse for picking up objects through portals
bool m_bPlayUseDenySound; // Signaled by PlayerUse, but can be unset by HL2 ladder code...
private:
CAI_Squad * m_pPlayerAISquad;
CSimpleSimTimer m_CommanderUpdateTimer;
float m_RealTimeLastSquadCommand;
CommanderCommand_t m_QueuedCommand;
Vector m_vecMissPositions[16];
int m_nNumMissPositions;
float m_flTimeIgnoreFallDamage;
bool m_bIgnoreFallDamageResetAfterImpact;
// Suit power fields
float m_flSuitPowerLoad; // net suit power drain (total of all device's drainrates)
float m_flAdmireGlovesAnimTime;
float m_flNextFlashlightCheckTime;
float m_flFlashlightPowerDrainScale;
// Aiming heuristics code
float m_flIdleTime; //Amount of time we've been motionless
float m_flMoveTime; //Amount of time we've been in motion
float m_flLastDamageTime; //Last time we took damage
float m_flTargetFindTime;
EHANDLE m_hPlayerProxy;
bool m_bFlashlightDisabled;
bool m_bUseCappedPhysicsDamageTable;
float m_flArmorReductionTime;
int m_iArmorReductionFrom;
float m_flTimeUseSuspended;
CSimpleSimTimer m_LowerWeaponTimer;
CSimpleSimTimer m_AutoaimTimer;
EHANDLE m_hLockedAutoAimEntity;
EHANDLE m_hLocatorTargetEntity; // The entity that's being tracked by the suit locator.
float m_flTimeNextLadderHint; // Next time we're eligible to display a HUD hint about a ladder.
friend class CHL2GameMovement;
};
//-----------------------------------------------------------------------------
// FIXME: find a better way to do this
// Switches us to a physics damage table that caps the max damage.
//-----------------------------------------------------------------------------
void CHL2_Player::EnableCappedPhysicsDamage()
{
m_bUseCappedPhysicsDamageTable = true;
}
void CHL2_Player::DisableCappedPhysicsDamage()
{
m_bUseCappedPhysicsDamageTable = false;
}
#endif //HL2_PLAYER_H