mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-01-24 05:34:18 +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
|
// CPlayerFreeze
|
||||||
//=========================================================
|
//=========================================================
|
||||||
|
|
||||||
class CPlayerFreeze : public CBaseDelay
|
class CTriggerPlayerFreeze : public CBaseDelay
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void Spawn(void);
|
|
||||||
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
|
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
|
||||||
|
int ObjectCaps( void ) { return CBaseDelay::ObjectCaps() & ~FCAP_ACROSS_TRANSITION; }
|
||||||
virtual int Save(CSave &save);
|
|
||||||
virtual int Restore(CRestore &restore);
|
|
||||||
static TYPEDESCRIPTION m_SaveData[];
|
|
||||||
|
|
||||||
EHANDLE m_hPlayer;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
LINK_ENTITY_TO_CLASS(trigger_playerfreeze, CPlayerFreeze);
|
LINK_ENTITY_TO_CLASS( trigger_playerfreeze, CTriggerPlayerFreeze )
|
||||||
|
|
||||||
|
void CTriggerPlayerFreeze::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
|
||||||
TYPEDESCRIPTION CPlayerFreeze::m_SaveData[] =
|
|
||||||
{
|
{
|
||||||
DEFINE_FIELD(CPlayerFreeze, m_hPlayer, FIELD_EHANDLE),
|
if( !pActivator || !pActivator->IsPlayer() )
|
||||||
};
|
pActivator = CBaseEntity::Instance( g_engfuncs.pfnPEntityOfEntIndex( 1 ) );
|
||||||
|
|
||||||
IMPLEMENT_SAVERESTORE(CPlayerFreeze, CBaseDelay);
|
if( pActivator && (pActivator->pev->flags & FL_FROZEN) )
|
||||||
|
( (CBasePlayer *)( (CBaseEntity *)pActivator ) )->EnableControl( TRUE );
|
||||||
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;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
( (CBasePlayer *)( (CBaseEntity *)pActivator ) )->EnableControl( FALSE );
|
||||||
ALERT(at_console, "ERROR: Couldn't find player entity.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
SetThink(&CPlayerFreeze::SUB_Remove);
|
|
||||||
pev->nextthink = gpGlobals->time;
|
|
||||||
}
|
}
|
@ -120,7 +120,6 @@ TYPEDESCRIPTION CBasePlayer::m_playerSaveData[] =
|
|||||||
DEFINE_FIELD( CBasePlayer, m_iFOV, FIELD_INTEGER ),
|
DEFINE_FIELD( CBasePlayer, m_iFOV, FIELD_INTEGER ),
|
||||||
|
|
||||||
DEFINE_FIELD(CBasePlayer, m_fInXen, FIELD_BOOLEAN),
|
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_fDeadTime, FIELD_FLOAT ), // only used in multiplayer games
|
||||||
//DEFINE_FIELD( CBasePlayer, m_fGameHUDInitialized, FIELD_INTEGER ), // 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_flNextChatTime = gpGlobals->time;
|
||||||
|
|
||||||
m_fInXen = FALSE;
|
m_fInXen = FALSE;
|
||||||
m_fIsFrozen = FALSE;
|
|
||||||
|
|
||||||
g_pGameRules->PlayerSpawn( this );
|
g_pGameRules->PlayerSpawn( this );
|
||||||
}
|
}
|
||||||
|
@ -336,7 +336,6 @@ public:
|
|||||||
// Op4 player attributes.
|
// Op4 player attributes.
|
||||||
//
|
//
|
||||||
BOOL m_fInXen;
|
BOOL m_fInXen;
|
||||||
BOOL m_fIsFrozen;
|
|
||||||
|
|
||||||
friend class CDisplacer;
|
friend class CDisplacer;
|
||||||
friend class CTriggerXenReturn;
|
friend class CTriggerXenReturn;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user