Fixed buy, hostage, bomb zones detections
This commit is contained in:
parent
d7149518d9
commit
d87ac59033
10 changed files with 43 additions and 33 deletions
|
@ -2231,10 +2231,6 @@ void C_CSPlayer::Simulate( void )
|
||||||
void C_CSPlayer::PostThink()
|
void C_CSPlayer::PostThink()
|
||||||
{
|
{
|
||||||
BaseClass::PostThink();
|
BaseClass::PostThink();
|
||||||
// Reset this.. it gets reset each frame that we're in a bomb zone.
|
|
||||||
m_bInBombZone = false;
|
|
||||||
m_bInBuyZone = false;
|
|
||||||
m_bInHostageRescueZone = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ public:
|
||||||
|
|
||||||
void CCSPrediction::StartCommand(CBasePlayer* player, CUserCmd* cmd)
|
void CCSPrediction::StartCommand(CBasePlayer* player, CUserCmd* cmd)
|
||||||
{
|
{
|
||||||
CCSPlayer *pPlayer = ToCSPlayer( player );
|
CCSPlayer* pPlayer = ToCSPlayer(player);
|
||||||
|
|
||||||
BaseClass::StartCommand( player, cmd );
|
BaseClass::StartCommand( player, cmd );
|
||||||
}
|
}
|
||||||
|
|
|
@ -888,12 +888,9 @@ void CPrediction::RunCommand( C_BasePlayer *player, CUserCmd *ucmd, IMoveHelper
|
||||||
g_pGameMovement->StartTrackPredictionErrors( player );
|
g_pGameMovement->StartTrackPredictionErrors( player );
|
||||||
|
|
||||||
gpGlobals->frametime = m_bEnginePaused ? 0 : TICK_INTERVAL;
|
gpGlobals->frametime = m_bEnginePaused ? 0 : TICK_INTERVAL;
|
||||||
// Run post think after PreThink/Think function, this makes a room space for local interpolation.
|
gpGlobals->curtime = player->m_nTickBase * TICK_INTERVAL;
|
||||||
gpGlobals->curtime = (player->m_nTickBase - 1) * TICK_INTERVAL;
|
|
||||||
|
|
||||||
RunPostThink( player );
|
|
||||||
|
|
||||||
gpGlobals->curtime = player->m_nTickBase * TICK_INTERVAL;
|
RunPostThink( player );
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
// TODO: Check for impulse predicted?
|
// TODO: Check for impulse predicted?
|
||||||
|
|
|
@ -1584,7 +1584,7 @@ void CCSPlayer::UpdateMouseoverHints()
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCSPlayer::PostThink()
|
void CCSPlayer::PostThink()
|
||||||
{
|
{
|
||||||
BaseClass::PostThink();
|
BaseClass::PostThink();
|
||||||
|
|
||||||
UpdateAddonBits();
|
UpdateAddonBits();
|
||||||
|
@ -1629,12 +1629,7 @@ void CCSPlayer::PostThink()
|
||||||
{
|
{
|
||||||
StopSound( "Player.AmbientUnderWater" );
|
StopSound( "Player.AmbientUnderWater" );
|
||||||
SetPlayerUnderwater( false );
|
SetPlayerUnderwater( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset this.. it gets reset each frame that we're in a bomb zone.
|
|
||||||
m_bInBombZone = false;
|
|
||||||
m_bInBuyZone = false;
|
|
||||||
m_bInHostageRescueZone = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -52,11 +52,6 @@ void CCSPlayerMove::StartCommand( CBasePlayer *player, CUserCmd *cmd )
|
||||||
{
|
{
|
||||||
CCSPlayer *pPlayer = ToCSPlayer( player );
|
CCSPlayer *pPlayer = ToCSPlayer( player );
|
||||||
|
|
||||||
// Reset this.. it gets reset each frame that we're in a bomb zone.
|
|
||||||
pPlayer->m_bInBombZone = false;
|
|
||||||
pPlayer->m_bInBuyZone = false;
|
|
||||||
pPlayer->m_bInHostageRescueZone = false;
|
|
||||||
|
|
||||||
BaseClass::StartCommand( player, cmd );
|
BaseClass::StartCommand( player, cmd );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,8 @@ LINK_ENTITY_TO_CLASS( func_bomb_target, CBombTarget );
|
||||||
|
|
||||||
BEGIN_DATADESC( CBombTarget )
|
BEGIN_DATADESC( CBombTarget )
|
||||||
DEFINE_FUNCTION( BombTargetTouch ),
|
DEFINE_FUNCTION( BombTargetTouch ),
|
||||||
DEFINE_FUNCTION( BombTargetUse ), //needed?
|
DEFINE_FUNCTION( BombTargetUse ),
|
||||||
|
DEFINE_FUNCTION( EndTouch ),
|
||||||
|
|
||||||
// Inputs
|
// Inputs
|
||||||
DEFINE_INPUTFUNC( FIELD_VOID, "BombExplode", OnBombExplode ),
|
DEFINE_INPUTFUNC( FIELD_VOID, "BombExplode", OnBombExplode ),
|
||||||
|
@ -60,6 +61,15 @@ void CBombTarget::BombTargetTouch( CBaseEntity* pOther )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CBombTarget::EndTouch(CBaseEntity* pOther)
|
||||||
|
{
|
||||||
|
CCSPlayer *p = dynamic_cast< CCSPlayer* >( pOther );
|
||||||
|
if ( p )
|
||||||
|
{
|
||||||
|
p->m_bInBombZone = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CBombTarget::BombTargetUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
void CBombTarget::BombTargetUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||||
{
|
{
|
||||||
//SUB_UseTargets( NULL, USE_TOGGLE, 0 );
|
//SUB_UseTargets( NULL, USE_TOGGLE, 0 );
|
||||||
|
|
|
@ -27,6 +27,7 @@ public:
|
||||||
bool IsHeistBombTarget( void ) { return m_bIsHeistBombTarget; }
|
bool IsHeistBombTarget( void ) { return m_bIsHeistBombTarget; }
|
||||||
const char *GetBombMountTarget( void ){ return STRING( m_szMountTarget ); }
|
const char *GetBombMountTarget( void ){ return STRING( m_szMountTarget ); }
|
||||||
|
|
||||||
|
virtual void EndTouch( CBaseEntity *pOther );
|
||||||
private:
|
private:
|
||||||
COutputEvent m_OnBombExplode; //Fired when the bomb explodes
|
COutputEvent m_OnBombExplode; //Fired when the bomb explodes
|
||||||
COutputEvent m_OnBombPlanted; //Fired when the bomb is planted
|
COutputEvent m_OnBombPlanted; //Fired when the bomb is planted
|
||||||
|
|
|
@ -23,6 +23,7 @@ public:
|
||||||
CBuyZone();
|
CBuyZone();
|
||||||
void Spawn();
|
void Spawn();
|
||||||
void EXPORT BuyZoneTouch( CBaseEntity* pOther );
|
void EXPORT BuyZoneTouch( CBaseEntity* pOther );
|
||||||
|
virtual void EndTouch( CBaseEntity *pOther );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int m_LegacyTeamNum;
|
int m_LegacyTeamNum;
|
||||||
|
@ -33,7 +34,7 @@ LINK_ENTITY_TO_CLASS( func_buyzone, CBuyZone );
|
||||||
|
|
||||||
BEGIN_DATADESC( CBuyZone )
|
BEGIN_DATADESC( CBuyZone )
|
||||||
DEFINE_FUNCTION( BuyZoneTouch ),
|
DEFINE_FUNCTION( BuyZoneTouch ),
|
||||||
|
DEFINE_FUNCTION( EndTouch ),
|
||||||
// This is here to support maps that haven't updated to using "teamnum" yet.
|
// This is here to support maps that haven't updated to using "teamnum" yet.
|
||||||
DEFINE_INPUT( m_LegacyTeamNum, FIELD_INTEGER, "team" )
|
DEFINE_INPUT( m_LegacyTeamNum, FIELD_INTEGER, "team" )
|
||||||
END_DATADESC()
|
END_DATADESC()
|
||||||
|
@ -70,8 +71,16 @@ void CBuyZone::BuyZoneTouch( CBaseEntity* pOther )
|
||||||
// compare player team with buy zone team number
|
// compare player team with buy zone team number
|
||||||
if ( p->GetTeamNumber() == GetTeamNumber() )
|
if ( p->GetTeamNumber() == GetTeamNumber() )
|
||||||
{
|
{
|
||||||
p->m_bInBuyZone = true;
|
p->m_bInBuyZone = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CBuyZone::EndTouch( CBaseEntity* pOther )
|
||||||
|
{
|
||||||
|
CCSPlayer *p = dynamic_cast< CCSPlayer* >( pOther );
|
||||||
|
if ( p )
|
||||||
|
{
|
||||||
|
p->m_bInBuyZone = false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include "cbase.h"
|
#include "cbase.h"
|
||||||
#include "triggers.h"
|
#include "triggers.h"
|
||||||
|
#include "cs_player.h"
|
||||||
|
|
||||||
class CHostageRescueZone : public CBaseTrigger
|
class CHostageRescueZone : public CBaseTrigger
|
||||||
{
|
{
|
||||||
|
@ -17,6 +18,8 @@ public:
|
||||||
void Spawn();
|
void Spawn();
|
||||||
|
|
||||||
void HostageRescueTouch( CBaseEntity* pOther );
|
void HostageRescueTouch( CBaseEntity* pOther );
|
||||||
|
|
||||||
|
virtual void EndTouch( CBaseEntity *pOther );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,3 +46,11 @@ void CHostageRescueZone::HostageRescueTouch( CBaseEntity *pOther )
|
||||||
pOther->AcceptInput( "OnRescueZoneTouch", NULL, NULL, emptyVariant, 0 );
|
pOther->AcceptInput( "OnRescueZoneTouch", NULL, NULL, emptyVariant, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CHostageRescueZone::EndTouch( CBaseEntity* pOther )
|
||||||
|
{
|
||||||
|
CCSPlayer *p = dynamic_cast< CCSPlayer* >( pOther );
|
||||||
|
if ( p )
|
||||||
|
{
|
||||||
|
p->m_bInHostageRescueZone = true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -339,12 +339,12 @@ void CPlayerMove::RunCommand ( CBasePlayer *player, CUserCmd *ucmd, IMoveHelper
|
||||||
return; // Don't process this command
|
return; // Don't process this command
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gpGlobals->frametime = playerFrameTime;
|
||||||
|
gpGlobals->curtime = player->m_nTickBase * TICK_INTERVAL;
|
||||||
|
|
||||||
StartCommand( player, ucmd );
|
StartCommand( player, ucmd );
|
||||||
|
|
||||||
g_pGameMovement->StartTrackPredictionErrors( player );
|
g_pGameMovement->StartTrackPredictionErrors( player );
|
||||||
|
|
||||||
gpGlobals->frametime = playerFrameTime;
|
|
||||||
gpGlobals->curtime = (player->m_nTickBase - 1) * TICK_INTERVAL;
|
|
||||||
|
|
||||||
if (ucmd->debug_hitboxes)
|
if (ucmd->debug_hitboxes)
|
||||||
{
|
{
|
||||||
|
@ -363,11 +363,7 @@ void CPlayerMove::RunCommand ( CBasePlayer *player, CUserCmd *ucmd, IMoveHelper
|
||||||
lagcompensation->FinishLagCompensation( player );
|
lagcompensation->FinishLagCompensation( player );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run post think first, this will let some space for client side interpolation.
|
RunPostThink( player );
|
||||||
RunPostThink( player );
|
|
||||||
|
|
||||||
// Set globals appropriately
|
|
||||||
gpGlobals->curtime = player->m_nTickBase * TICK_INTERVAL;
|
|
||||||
|
|
||||||
// Prevent hacked clients from sending us invalid view angles to try to get leaf server code to crash
|
// Prevent hacked clients from sending us invalid view angles to try to get leaf server code to crash
|
||||||
if ( !ucmd->viewangles.IsValid() || !IsEntityQAngleReasonable(ucmd->viewangles) )
|
if ( !ucmd->viewangles.IsValid() || !IsEntityQAngleReasonable(ucmd->viewangles) )
|
||||||
|
|
Loading…
Reference in a new issue