From 6d0c20febcaf0ca54d864af0f5457162214289de Mon Sep 17 00:00:00 2001 From: hlstriker Date: Tue, 3 Dec 2013 02:01:09 +0000 Subject: [PATCH] Start of item_ff_goal. --- mp/src/game/client/ff/ff_cl_player.cpp | 2 +- .../server/ff/entities/ff_sv_item_ff_goal.cpp | 252 ------------------ mp/src/game/server/hl2/hl2_player.cpp | 4 +- .../shared/ff/entities/ff_sh_base_ff_goal.cpp | 4 +- .../shared/ff/entities/ff_sh_base_ff_goal.h | 2 +- .../shared/ff/entities/ff_sh_item_ff_goal.cpp | 49 +++- .../shared/ff/entities/ff_sh_item_ff_goal.h | 22 +- mp/src/game/shared/movevars_shared.cpp | 2 +- 8 files changed, 61 insertions(+), 276 deletions(-) delete mode 100644 mp/src/game/server/ff/entities/ff_sv_item_ff_goal.cpp diff --git a/mp/src/game/client/ff/ff_cl_player.cpp b/mp/src/game/client/ff/ff_cl_player.cpp index 382b1595..28a36f02 100644 --- a/mp/src/game/client/ff/ff_cl_player.cpp +++ b/mp/src/game/client/ff/ff_cl_player.cpp @@ -39,7 +39,7 @@ BEGIN_PREDICTION_DATA( CFF_CL_Player ) END_PREDICTION_DATA() #define HL2_WALK_SPEED 150 -#define HL2_NORM_SPEED 190 +#define HL2_NORM_SPEED 280 #define HL2_SPRINT_SPEED 320 static ConVar cl_playermodel( "cl_playermodel", "none", FCVAR_USERINFO | FCVAR_ARCHIVE | FCVAR_SERVER_CAN_EXECUTE, "Default Player Model"); diff --git a/mp/src/game/server/ff/entities/ff_sv_item_ff_goal.cpp b/mp/src/game/server/ff/entities/ff_sv_item_ff_goal.cpp deleted file mode 100644 index 7a78728a..00000000 --- a/mp/src/game/server/ff/entities/ff_sv_item_ff_goal.cpp +++ /dev/null @@ -1,252 +0,0 @@ -#include "cbase.h" -#include "ff_sv_goal_manager.h" -#include "ff_sv_item_ff_goal.h" - - -LINK_ENTITY_TO_CLASS( item_ff_goal, CFF_SV_ItemFFGoal ); - -BEGIN_DATADESC( CFF_SV_ItemFFGoal ) -END_DATADESC() - - -CFF_SV_ItemFFGoal::CFF_SV_ItemFFGoal() -{ - BaseClass::InitGoal( FF_GOALTYPE_ITEM ); -} - -void CFF_SV_ItemFFGoal::Spawn() -{ - // TODO: Check if needs to drop to floor. - if( false ) - UTIL_DropToFloor( this, MASK_SOLID ); - - m_vecSpawnOrigin = GetAbsOrigin(); -} - -CBasePlayer* CFF_SV_ItemFFGoal::GetCarrier() -{ - return m_hItemCarrier; -} - -const Vector& CFF_SV_ItemFFGoal::GetSpawnOrigin() -{ - return m_vecSpawnOrigin; -} - - -/* -#include "cbase.h" -#include "ff_sv_teamcheck_target.h" - - -class CFF_SV_ItemFFGoal : public CBaseAnimating -{ -public: - DECLARE_CLASS( CFF_SV_ItemFFGoal, CBaseAnimating ); - DECLARE_DATADESC(); - - CFF_SV_ItemFFGoal() - { - SetThink( NULL ); - - m_bEnabled = true; - m_bActive = false; - - m_fActiveTime = 1.5f; - m_fActiveDelay = 0.0f; - } - - void Precache( void ); - void Spawn( void ); - - void OnTouch( CBaseEntity *pOther ); - - void SetActive( CBasePlayer *pPlayer ); - void SetInactive( void ); - -private: - COutputEvent m_OnStartTouch; - COutputEvent m_OnEndTouch; - - void InputEnable( inputdata_t &inputdata ); - void InputDisable( inputdata_t &inputdata ); - void InputSetActive( inputdata_t &inputdata ); - void InputSetInactive( inputdata_t &inputdata ); - - void ThinkDoActive( void ); - void ThinkSetInactive( void ); - - bool m_bEnabled; // If disabled then the goal will ignore all Inputs (except for Enable). - bool m_bActive; // Is the goal active? - - float m_fActiveTime; // How long to stay in the active state. - float m_fActiveDelay; // How long to wait before going in the active state. - - // TODO: These probably don't need to be EHANDLEs unless we network them... - EHANDLE m_hGoalActivator; // The player that activated this goal (this is not always the owner). - EHANDLE m_hGoalOwner; // The player that owns this goal (this is not always the activator). - - string_t m_iszSoundName; -}; - - -LINK_ENTITY_TO_CLASS( item_ff_goal, CFF_SV_ItemFFGoal ); - -BEGIN_DATADESC( CFF_SV_ItemFFGoal ) - // Goal keyfields. - DEFINE_KEYFIELD_NOT_SAVED( m_bEnabled, FIELD_BOOLEAN, "enabled" ), - DEFINE_KEYFIELD_NOT_SAVED( m_bActive, FIELD_BOOLEAN, "active" ), - DEFINE_KEYFIELD_NOT_SAVED( m_fActiveTime, FIELD_FLOAT, "active_time" ), - DEFINE_KEYFIELD_NOT_SAVED( m_fActiveDelay, FIELD_FLOAT, "active_delay" ), - - DEFINE_KEYFIELD_NOT_SAVED( m_iszSoundName, FIELD_SOUNDNAME, "sound" ), - - // Goal touch functions. - DEFINE_FUNCTION( OnTouch ), - - // Goal think functions. - DEFINE_THINKFUNC( ThinkDoActive ), - DEFINE_THINKFUNC( ThinkSetInactive ), - - // Goal inputs. - DEFINE_INPUTFUNC( FIELD_VOID, "Enable", InputEnable ), - DEFINE_INPUTFUNC( FIELD_VOID, "Disable", InputDisable ), - DEFINE_INPUTFUNC( FIELD_VOID, "SetActive", InputSetActive ), - DEFINE_INPUTFUNC( FIELD_VOID, "SetInactive", InputSetInactive ), -END_DATADESC() - - -void CFF_SV_ItemFFGoal::Precache( void ) -{ - if( GetModelName().ToCStr()[0] ) - PrecacheModel( GetModelName().ToCStr() ); - - const char *szSound = m_iszSoundName.ToCStr(); - if( m_iszSoundName != NULL_STRING ) - { - if (*szSound != '!') - PrecacheScriptSound(szSound); - } - - BaseClass::Precache(); -} - -void CFF_SV_ItemFFGoal::Spawn( void ) -{ - Precache(); - - if( GetModelName().ToCStr()[0] ) - SetModel( GetModelName().ToCStr() ); - - SetMoveType( MOVETYPE_NONE ); - //SetSolid( SOLID_VPHYSICS ); // WARNING: If the entity doesn't have a model then we MUST use SOLID_BBOX or the game will crash. - SetSolid( SOLID_BBOX ); - AddSolidFlags( FSOLID_NOT_SOLID | FSOLID_TRIGGER ); - - SetTouch( &CFF_SV_ItemFFGoal::OnTouch ); -} - -void CFF_SV_ItemFFGoal::OnTouch( CBaseEntity *pOther ) -{ - // TODO: Should we just hook this function in StartTouch() instead? - - if(!m_bEnabled || m_bActive) - return; - - // Make sure pOther is a player. - CBasePlayer *pPlayer = dynamic_cast(pOther); - if(!pPlayer) - return; - - SetActive(pPlayer); -} - -void CFF_SV_ItemFFGoal::InputEnable( inputdata_t &inputdata ) -{ - m_bEnabled = true; -} - -void CFF_SV_ItemFFGoal::InputDisable( inputdata_t &inputdata ) -{ - m_bEnabled = false; -} - -void CFF_SV_ItemFFGoal::InputSetActive( inputdata_t &inputdata ) -{ - if(!m_bEnabled || m_bActive) - return; - - SetActive( dynamic_cast(inputdata.pActivator) ); -} - -void CFF_SV_ItemFFGoal::InputSetInactive( inputdata_t &inputdata ) -{ - if(!m_bEnabled || !m_bActive) - return; - - SetInactive(); -} - -void CFF_SV_ItemFFGoal::SetActive( CBasePlayer *pPlayer ) -{ - if( !IsTeamAllowed( pPlayer->GetTeamNumber() ) ) - return; - - m_hGoalActivator = pPlayer; - m_bActive = true; - - if(m_fActiveDelay) - { - SetThink( &CFF_SV_ItemFFGoal::ThinkDoActive ); - SetNextThink( gpGlobals->curtime + m_fActiveDelay ); - } - else - { - ThinkDoActive(); - } -} - -void CFF_SV_ItemFFGoal::SetInactive() -{ - RemoveEffects( EF_NODRAW ); - - m_bActive = false; - - SetThink( NULL ); -} - -void CFF_SV_ItemFFGoal::ThinkDoActive() -{ - AddEffects( EF_NODRAW ); - - if( m_iszSoundName.ToCStr()[0] ) - { - CRecipientFilter filter; - filter.AddRecipientsByPVS( GetAbsOrigin() ); - filter.MakeReliable(); - - EmitSound_t params; - params.m_pSoundName = m_iszSoundName.ToCStr(); - params.m_SoundLevel = SNDLVL_NORM; - - if( filter.GetRecipientCount() ) - EmitSound( filter, ENTINDEX(this), params ); - } - - // Start setting inactive. - if(m_fActiveTime) - { - SetThink( &CFF_SV_ItemFFGoal::ThinkSetInactive ); - SetNextThink( gpGlobals->curtime + m_fActiveTime ); - } - else - { - ThinkSetInactive(); - } -} - -void CFF_SV_ItemFFGoal::ThinkSetInactive() -{ - SetInactive(); -} -*/ \ No newline at end of file diff --git a/mp/src/game/server/hl2/hl2_player.cpp b/mp/src/game/server/hl2/hl2_player.cpp index b45887cd..687e3bba 100644 --- a/mp/src/game/server/hl2/hl2_player.cpp +++ b/mp/src/game/server/hl2/hl2_player.cpp @@ -80,14 +80,14 @@ extern int gEvilImpulse101; ConVar sv_autojump( "sv_autojump", "0" ); ConVar hl2_walkspeed( "hl2_walkspeed", "150" ); -ConVar hl2_normspeed( "hl2_normspeed", "190" ); +ConVar hl2_normspeed( "hl2_normspeed", "280" ); ConVar hl2_sprintspeed( "hl2_sprintspeed", "320" ); ConVar hl2_darkness_flashlight_factor ( "hl2_darkness_flashlight_factor", "1" ); #ifdef HL2MP #define HL2_WALK_SPEED 150 - #define HL2_NORM_SPEED 190 + #define HL2_NORM_SPEED 280 #define HL2_SPRINT_SPEED 320 #else #define HL2_WALK_SPEED hl2_walkspeed.GetFloat() diff --git a/mp/src/game/shared/ff/entities/ff_sh_base_ff_goal.cpp b/mp/src/game/shared/ff/entities/ff_sh_base_ff_goal.cpp index 4eb62f21..26d70d26 100644 --- a/mp/src/game/shared/ff/entities/ff_sh_base_ff_goal.cpp +++ b/mp/src/game/shared/ff/entities/ff_sh_base_ff_goal.cpp @@ -36,7 +36,7 @@ BEGIN_DATADESC( CFF_SH_BaseFFGoal ) DEFINE_KEYFIELD_NOT_SAVED( m_iszActivationSound, FIELD_SOUNDNAME, "activation_sound" ), DEFINE_KEYFIELD_NOT_SAVED( m_iszResetSound, FIELD_SOUNDNAME, "reset_sound" ), - DEFINE_KEYFIELD_NOT_SAVED( m_iszFailedCriteriaMessage, FIELD_STRING, "msg_if_activator_fails_criteria" ), + DEFINE_KEYFIELD_NOT_SAVED( m_iszFailedCriteriaMessage, FIELD_STRING, "msg_if_ap_fails_criteria" ), // Criteria check keys. DEFINE_KEYFIELD_NOT_SAVED( m_iszCriteria_TeamsAllowed, FIELD_STRING, "teams_allowed" ), @@ -428,7 +428,7 @@ void CFF_SH_BaseFFGoal::Spawn() Precache(); ParseCriteriaKeyValues(); - BaseClass::Activate(); + BaseClass::Spawn(); } void CFF_SH_BaseFFGoal::Activate() diff --git a/mp/src/game/shared/ff/entities/ff_sh_base_ff_goal.h b/mp/src/game/shared/ff/entities/ff_sh_base_ff_goal.h index 038b250a..09e9927b 100644 --- a/mp/src/game/shared/ff/entities/ff_sh_base_ff_goal.h +++ b/mp/src/game/shared/ff/entities/ff_sh_base_ff_goal.h @@ -43,7 +43,7 @@ public: virtual void OnTouching( CBaseEntity *pOther ); // NOTE: This function is called from its derived classes SetTouch() function (BaseClass::OnTouching()). void TryActivateGoal( CBaseEntity *pActivator ); - void ActivateGoalStart( CBaseEntity *pActivator ); + virtual void ActivateGoalStart( CBaseEntity *pActivator ); virtual void ActivateGoal( void ); virtual void DeactivateGoal( void ); #endif diff --git a/mp/src/game/shared/ff/entities/ff_sh_item_ff_goal.cpp b/mp/src/game/shared/ff/entities/ff_sh_item_ff_goal.cpp index 30f6cd40..c4cd72c7 100644 --- a/mp/src/game/shared/ff/entities/ff_sh_item_ff_goal.cpp +++ b/mp/src/game/shared/ff/entities/ff_sh_item_ff_goal.cpp @@ -5,26 +5,28 @@ LINK_ENTITY_TO_CLASS( item_ff_goal, CFF_SH_ItemFFGoal ); #ifdef GAME_DLL +BEGIN_DATADESC( CFF_SH_ItemFFGoal ) + // Goal touch functions. + DEFINE_FUNCTION( OnTouching ), +END_DATADESC() + IMPLEMENT_SERVERCLASS_ST( CFF_SH_ItemFFGoal, DT_FF_ItemFFGoal ) + SendPropEHandle( SENDINFO( m_hItemCarrier ) ), + SendPropVector( SENDINFO( m_vecSpawnOrigin ) ), END_SEND_TABLE() #else IMPLEMENT_CLIENTCLASS_DT( CFF_SH_ItemFFGoal, DT_FF_ItemFFGoal, CFF_SH_ItemFFGoal ) + RecvPropEHandle( RECVINFO( m_hItemCarrier ) ), + RecvPropVector( RECVINFO( m_vecSpawnOrigin ) ), END_RECV_TABLE() #endif -#ifdef GAME_DLL void CFF_SH_ItemFFGoal::Spawn() { BaseClass::Spawn(); - - // TODO: Check if needs to drop to floor. Note: This should be done in the info_ versions spawn - if( false ) - UTIL_DropToFloor( this, MASK_SOLID ); - m_vecSpawnOrigin = GetAbsOrigin(); } -#endif CBasePlayer* CFF_SH_ItemFFGoal::GetCarrier() { @@ -35,3 +37,36 @@ const Vector& CFF_SH_ItemFFGoal::GetSpawnOrigin() { return m_vecSpawnOrigin; } + +#ifdef GAME_DLL +void CFF_SH_ItemFFGoal::OnTouching( CBaseEntity *pOther ) +{ + BaseClass::OnTouching( pOther ); +} + +void CFF_SH_ItemFFGoal::ActivateGoalStart( CBaseEntity *pActivator ) +{ + BaseClass::ActivateGoalStart( pActivator ); + + CBasePlayer *pPlayer = dynamic_cast(pActivator); + if( !pPlayer ) + return; + + // Parent this item to the activator. + SetSolid( SOLID_NONE ); + SetParent( pPlayer ); + + m_hItemCarrier = pPlayer; +} + +void CFF_SH_ItemFFGoal::ActivateGoal() +{ + BaseClass::ActivateGoal(); + RemoveEffects( EF_NODRAW ); +} + +void CFF_SH_ItemFFGoal::DeactivateGoal() +{ + BaseClass::DeactivateGoal(); +} +#endif diff --git a/mp/src/game/shared/ff/entities/ff_sh_item_ff_goal.h b/mp/src/game/shared/ff/entities/ff_sh_item_ff_goal.h index 480454e1..50cf28fc 100644 --- a/mp/src/game/shared/ff/entities/ff_sh_item_ff_goal.h +++ b/mp/src/game/shared/ff/entities/ff_sh_item_ff_goal.h @@ -4,19 +4,16 @@ #define FF_SH_ITEM_FF_GOAL_H -#ifdef GAME_DLL -#include "baseanimating.h" -#else -#include "c_baseanimating.h" -#endif +#include "ff_sh_info_ff_goal.h" -class CFF_SH_ItemFFGoal : public CBaseAnimating // TODO: Derive from info_ version. Note: info_ should still derive from CBaseAnimating. +class CFF_SH_ItemFFGoal : public CFF_SH_InfoFFGoal { public: - DECLARE_CLASS( CFF_SH_ItemFFGoal, CBaseAnimating ); // TODO: Derive from info_ version. Note: info_ should still derive from CBaseAnimating. + DECLARE_CLASS( CFF_SH_ItemFFGoal, CFF_SH_InfoFFGoal ); #ifdef GAME_DLL + DECLARE_DATADESC(); DECLARE_SERVERCLASS(); #else DECLARE_CLIENTCLASS(); @@ -27,9 +24,14 @@ public: CBasePlayer* GetCarrier( void ); const Vector& GetSpawnOrigin( void ); -#ifdef GAME_DLL void Spawn( void ); +#ifdef GAME_DLL + virtual void OnTouching( CBaseEntity *pOther ); + virtual void ActivateGoalStart( CBaseEntity *pActivator ); + virtual void ActivateGoal( void ); + virtual void DeactivateGoal( void ); + int UpdateTransmitState( void ) { // The goal must always be transmitted because client side relys on knowing about each goal. @@ -39,8 +41,8 @@ public: #endif private: - CHandle m_hItemCarrier; // TODO: network this. - Vector m_vecSpawnOrigin; // TODO: network this. + CNetworkHandle( CBasePlayer, m_hItemCarrier ); + CNetworkVector( m_vecSpawnOrigin ); }; diff --git a/mp/src/game/shared/movevars_shared.cpp b/mp/src/game/shared/movevars_shared.cpp index 06ba99de..f150a508 100644 --- a/mp/src/game/shared/movevars_shared.cpp +++ b/mp/src/game/shared/movevars_shared.cpp @@ -61,7 +61,7 @@ ConVar sv_maxspeed ( "sv_maxspeed", "600", FCVAR_NOTIFY | FCVAR_REPLICATED | FC #if defined( CSTRIKE_DLL ) ConVar sv_accelerate ( "sv_accelerate", "10", FCVAR_NOTIFY | FCVAR_REPLICATED); #else - ConVar sv_accelerate ( "sv_accelerate", "14", FCVAR_NOTIFY | FCVAR_REPLICATED | FCVAR_DEVELOPMENTONLY); + ConVar sv_accelerate ( "sv_accelerate", "9", FCVAR_NOTIFY | FCVAR_REPLICATED | FCVAR_DEVELOPMENTONLY); #endif // CSTRIKE_DLL #endif//_XBOX