mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-01-23 21:24:27 +00:00
Update trigger_playerfreeze
This commit is contained in:
parent
640a624af8
commit
eb086db702
@ -135,71 +135,22 @@ LINK_ENTITY_TO_CLASS(trigger_geneworm_hit, CTriggerMultiple);
|
||||
// CPlayerFreeze
|
||||
//=========================================================
|
||||
|
||||
class CPlayerFreeze : public CBaseDelay
|
||||
class CTriggerPlayerFreeze : public CBaseDelay
|
||||
{
|
||||
public:
|
||||
void Spawn(void);
|
||||
void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
|
||||
|
||||
virtual int Save(CSave &save);
|
||||
virtual int Restore(CRestore &restore);
|
||||
static TYPEDESCRIPTION m_SaveData[];
|
||||
|
||||
EHANDLE m_hPlayer;
|
||||
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
|
||||
int ObjectCaps( void ) { return CBaseDelay::ObjectCaps() & ~FCAP_ACROSS_TRANSITION; }
|
||||
};
|
||||
|
||||
LINK_ENTITY_TO_CLASS(trigger_playerfreeze, CPlayerFreeze);
|
||||
LINK_ENTITY_TO_CLASS( trigger_playerfreeze, CTriggerPlayerFreeze )
|
||||
|
||||
|
||||
TYPEDESCRIPTION CPlayerFreeze::m_SaveData[] =
|
||||
void CTriggerPlayerFreeze::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||
{
|
||||
DEFINE_FIELD(CPlayerFreeze, m_hPlayer, FIELD_EHANDLE),
|
||||
};
|
||||
if( !pActivator || !pActivator->IsPlayer() )
|
||||
pActivator = CBaseEntity::Instance( g_engfuncs.pfnPEntityOfEntIndex( 1 ) );
|
||||
|
||||
IMPLEMENT_SAVERESTORE(CPlayerFreeze, CBaseDelay);
|
||||
|
||||
void CPlayerFreeze::Spawn(void)
|
||||
{
|
||||
CBaseDelay::Spawn();
|
||||
|
||||
m_hPlayer.Set(NULL);
|
||||
|
||||
CBaseEntity* pPlayer = UTIL_PlayerByIndex( 1 );
|
||||
|
||||
if (pPlayer)
|
||||
{
|
||||
m_hPlayer = pPlayer;
|
||||
}
|
||||
}
|
||||
|
||||
void CPlayerFreeze::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value)
|
||||
{
|
||||
CBaseEntity* pPlayer = NULL;
|
||||
|
||||
if (!m_hPlayer.Get())
|
||||
{
|
||||
CBaseEntity* pPlayer = UTIL_PlayerByIndex(1);
|
||||
|
||||
if (pPlayer)
|
||||
{
|
||||
m_hPlayer = pPlayer;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_hPlayer.Get())
|
||||
{
|
||||
#ifdef DEBUG
|
||||
ASSERT(m_hPlayer != NULL);
|
||||
#endif
|
||||
m_hPlayer->pev->movetype = (m_hPlayer->pev->movetype == MOVETYPE_NONE)
|
||||
? MOVETYPE_WALK
|
||||
: MOVETYPE_NONE;
|
||||
}
|
||||
if( pActivator && (pActivator->pev->flags & FL_FROZEN) )
|
||||
( (CBasePlayer *)( (CBaseEntity *)pActivator ) )->EnableControl( TRUE );
|
||||
else
|
||||
{
|
||||
ALERT(at_console, "ERROR: Couldn't find player entity.\n");
|
||||
}
|
||||
|
||||
SetThink(&CPlayerFreeze::SUB_Remove);
|
||||
pev->nextthink = gpGlobals->time;
|
||||
}
|
||||
( (CBasePlayer *)( (CBaseEntity *)pActivator ) )->EnableControl( FALSE );
|
||||
}
|
||||
|
@ -120,7 +120,6 @@ TYPEDESCRIPTION CBasePlayer::m_playerSaveData[] =
|
||||
DEFINE_FIELD( CBasePlayer, m_iFOV, FIELD_INTEGER ),
|
||||
|
||||
DEFINE_FIELD(CBasePlayer, m_fInXen, FIELD_BOOLEAN),
|
||||
DEFINE_FIELD(CBasePlayer, m_fIsFrozen, FIELD_BOOLEAN),
|
||||
|
||||
//DEFINE_FIELD( CBasePlayer, m_fDeadTime, FIELD_FLOAT ), // only used in multiplayer games
|
||||
//DEFINE_FIELD( CBasePlayer, m_fGameHUDInitialized, FIELD_INTEGER ), // only used in multiplayer games
|
||||
@ -2950,7 +2949,6 @@ void CBasePlayer::Spawn( void )
|
||||
m_flNextChatTime = gpGlobals->time;
|
||||
|
||||
m_fInXen = FALSE;
|
||||
m_fIsFrozen = FALSE;
|
||||
|
||||
g_pGameRules->PlayerSpawn( this );
|
||||
}
|
||||
|
@ -336,7 +336,6 @@ public:
|
||||
// Op4 player attributes.
|
||||
//
|
||||
BOOL m_fInXen;
|
||||
BOOL m_fIsFrozen;
|
||||
|
||||
friend class CDisplacer;
|
||||
friend class CTriggerXenReturn;
|
||||
|
Loading…
x
Reference in New Issue
Block a user