mirror of
https://github.com/fortressforever/fortressforever-2013.git
synced 2024-11-25 05:41:13 +00:00
Start of item_ff_goal.
This commit is contained in:
parent
4e73cc9250
commit
6d0c20febc
8 changed files with 61 additions and 276 deletions
|
@ -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");
|
||||
|
|
|
@ -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<CBasePlayer *>(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<CBasePlayer *>(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();
|
||||
}
|
||||
*/
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<CBasePlayer *>(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
|
||||
|
|
|
@ -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<CBasePlayer> m_hItemCarrier; // TODO: network this.
|
||||
Vector m_vecSpawnOrigin; // TODO: network this.
|
||||
CNetworkHandle( CBasePlayer, m_hItemCarrier );
|
||||
CNetworkVector( m_vecSpawnOrigin );
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue